[FFmpeg-cvslog] r13800 - trunk/libavformat/mov.c

Michael Niedermayer michaelni
Wed Jun 18 11:11:25 CEST 2008


On Wed, Jun 18, 2008 at 10:43:59AM +0200, Benoit Fouet wrote:
> bcoudurier wrote:
> > Modified: trunk/libavformat/mov.c
> > ==============================================================================
> > --- trunk/libavformat/mov.c	(original)
> > +++ trunk/libavformat/mov.c	Wed Jun 18 10:30:50 2008
> > @@ -1899,6 +1899,7 @@ static int mov_read_close(AVFormatContex
> >          av_freep(&sc->drefs);
> >          if (sc->pb && sc->pb != s->pb)
> >              url_fclose(sc->pb);
> > +        av_freep(&sc);
> >   
> 
> av_free() should be enough if done on sc

&s->streams[i]->priv_data really should be set to NULL if its freed in
a demuxer! And a comment should be added that its not the correct place
to free priv_data, so the code does not get forgotten ...

The correct place to free priv_data is av_close_input_stream(). For
muxers its freed in av_write_trailer() and not each muxer individually.
Now the more demuxers add such free but not zero hacks the harder it will
be to fix the bug properly because there will be dozends of double free
errors. (that after all is the reason why i did not just add a free()
in av_close_input_stream(), it requires demuxers to be checked that they
do not free it. The more demuxers free it the more work i have to clean
this mess up, so please if you do add such hacks add a 
//FIXME this is totally wrong and should not be here
st->priv_data = NULL

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20080618/48f7b7af/attachment.pgp>



More information about the ffmpeg-cvslog mailing list