[MPlayer-dev-eng] [PATCH] fix bug in free_demuxer
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Thu Aug 18 16:59:50 CEST 2005
Hi,
On Thu, Aug 18, 2005 at 10:27:30PM +0800, Meihui Fan wrote:
> Let's make all demuxer freed in free_demuxer,
> so we don't have to access the member(demux->desc->type) of the demuxer
> which already freed in libmpdemux/demux_demuxer.c/demux_close_demuxers.
>
> This bug may cause the MPlayer crashed when playing separated video and
> audio file.
How about the attached patch instead? I looks cleaner to my eyes *g*.
But be aware that I broke that feature already once, so better have a
very close look :-P
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.197
diff -u -r1.197 demuxer.c
--- libmpdemux/demuxer.c 11 Aug 2005 17:01:13 -0000 1.197
+++ libmpdemux/demuxer.c 18 Aug 2005 14:56:57 -0000
@@ -260,7 +260,7 @@
demuxer->desc->close(demuxer);
// Very ugly hack to make it behave like old implementation
if (demuxer->desc->type == DEMUXER_TYPE_DEMUXERS)
- return;
+ goto skip_streamfree;
// free streams:
for(i = 0; i < MAX_A_STREAMS; i++)
if(demuxer->a_streams[i]) free_sh_audio(demuxer->a_streams[i]);
@@ -272,6 +272,7 @@
free_demuxer_stream(demuxer->audio);
free_demuxer_stream(demuxer->video);
free_demuxer_stream(demuxer->sub);
+skip_streamfree:
if(demuxer->info) {
for(i=0;demuxer->info[i] != NULL; i++)
free(demuxer->info[i]);
Index: libmpdemux/demux_demuxers.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_demuxers.c,v
retrieving revision 1.5
diff -u -r1.5 demux_demuxers.c
--- libmpdemux/demux_demuxers.c 5 Aug 2005 19:57:46 -0000 1.5
+++ libmpdemux/demux_demuxers.c 18 Aug 2005 14:57:02 -0000
@@ -104,12 +104,6 @@
}
free(priv);
- if(demuxer->info) {
- for(i=0;demuxer->info[i] != NULL; i++)
- free(demuxer->info[i]);
- free(demuxer->info);
- }
- free(demuxer);
}
More information about the MPlayer-dev-eng
mailing list