[Ffmpeg-devel] [PATCH] CRYO APC demuxer
Reimar Döffinger
Reimar.Doeffinger
Sat Apr 7 15:47:30 CEST 2007
Hello,
On Sat, Apr 07, 2007 at 04:41:36PM +0300, Anssi Hannula wrote:
> Michael Niedermayer wrote:
> > On Sat, Apr 07, 2007 at 02:37:56PM +0200, Reimar D?ffinger wrote:
> > [...]
>
> >>> + st->codec->sample_rate = get_le32(pb);
> >>> +
> >>> + st->codec->extradata_size = 2 * sizeof(int);
> >>> + st->codec->extradata = av_malloc(st->codec->extradata_size +
> >>> + FF_INPUT_BUFFER_PADDING_SIZE);
> >>> + if (!st->codec->extradata) {
> >>> + if (st->codec)
> >>> + av_free(st->codec);
> >>> + av_free(st);
> >> Hmm... none of the other demuxers free st->codec. Actually, they just
> >> ignore when they can't set extradata. No idea what is the right
> >> behaviour.
> >
> > they likely segfault after mem alloc failure
Don't think so. At least mov.c checks for extradata != NULL. It just
does nothing if it is == NULL. Not sure that is such a good thing
though.
> >> But freeing st after it was registered really seems wrong to me.
> >
> > yes to me too
>
> So should I ignore extradata as well?
IMO no, just don't do the frees on failure. And/or check with valgrind that it's
right. If there isn't some other code that frees all streams and codec
entries on error return that is a bug IMO, it would be stupid to have
all demuxers duplicate that code.
Greetings,
Reimar D?ffinger
More information about the ffmpeg-devel
mailing list