[Ffmpeg-devel] [PATCH] CRYO APC demuxer

Michael Niedermayer michaelni
Sat Apr 7 20:30:08 CEST 2007


Hi

On Sat, Apr 07, 2007 at 09:19:51PM +0300, Anssi Hannula wrote:
[...]
> > 
> >> +    st->codec->extradata = av_malloc(st->codec->extradata_size +
> >> +                                     FF_INPUT_BUFFER_PADDING_SIZE);
> >> +    if (!st->codec->extradata) {
> >> +        av_free(st->codec);
> >> +        av_free(st);
> > 
> > if you insist on this freeing stuff
> 
> Well IMHO it is preferred to having a memleak... Of course we could just
> ignore the allocation failure and do not set extradata at all, avoiding
> the freeing.

IMHO memleak is better then later calling free on a pointer stored in
unallocated memory which will happen as soon as someone fixed
av_open_input_stream() to do proper cleanup


> 
> > at least set the pointers to NULL so
> > no double free can happen
> 
> Hmm... The st->codec pointer is removed right after the
> av_free(st->codec) when av_free(st) is done, so NULLing it seems
> pointless to me. And the st pointer is local to this function, so it is
> gone right in the next line when the function returns.

see AVFormatContext.streams and nb_streams

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070407/ed282b07/attachment.pgp>



More information about the ffmpeg-devel mailing list