changeset 23592:76bed8202233

Fix memleak due to not freeing demuxer->s_streams
author reimar
date Sat, 23 Jun 2007 17:39:27 +0000
parents 7acf8cc042b0
children 1bb33276e2de
files libmpdemux/demuxer.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Sat Jun 23 16:57:27 2007 +0000
+++ b/libmpdemux/demuxer.c	Sat Jun 23 17:39:27 2007 +0000
@@ -226,6 +226,11 @@
   return demuxer->s_streams[id];
 }
 
+void free_sh_sub(sh_sub_t *sh) {
+    mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_sub at %p\n", sh);
+    free(sh);
+}
+
 sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid){
     if(id > MAX_A_STREAMS-1 || id < 0)
     {
@@ -296,6 +301,8 @@
 	if(demuxer->a_streams[i]) free_sh_audio(demuxer, i);
     for(i = 0; i < MAX_V_STREAMS; i++)
 	if(demuxer->v_streams[i]) free_sh_video(demuxer->v_streams[i]);
+    for(i = 0; i < MAX_S_STREAMS; i++)
+	if(demuxer->s_streams[i]) free_sh_sub(demuxer->s_streams[i]);
     // free demuxers:
     free_demuxer_stream(demuxer->audio);
     free_demuxer_stream(demuxer->video);