[Ffmpeg-devel] [PATCH] CRYO APC demuxer

Michael Niedermayer michaelni
Sat Apr 7 19:55:26 CEST 2007


Hi

On Sat, Apr 07, 2007 at 08:01:18PM +0300, Anssi Hannula wrote:
> Anssi Hannula wrote:
> > Hi!
> > 
> > Attached is a patch implementing a demuxer for CRYO APC, a simple audio
> > format using ADPCM encoding.
> > 
> > Please review.
> 
> Attached is a patch updated as per Michael's and Reimar's comments.
> 
> I still av_free() st->codec and st on failure, though, as otherwise
> there would be a memleak. Maybe av_free_stream() should be separated
> >from av_close_input_file() and have the demuxers call it when failure
> occurs in read_header() after streams are allocated, or alternatively
> have the av_open_input_stream() call it when read_header() returns with
> an error. That belongs to a separate patch, though.

[...]

> +    st->codec->extradata_size = 2 * sizeof(int);

sizeof(int) is wrong, theres nothing guranteeing that its 4 but the format
will not magically change if the compiler/architecture has a larger int


> +    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 at least set the pointers to NULL so
no double free can happen


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

I count him braver who overcomes his desires than him who conquers his
enemies for the hardest victory is over self. -- Aristotle
-------------- 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/b47b3fdc/attachment.pgp>



More information about the ffmpeg-devel mailing list