On Thu, Mar 12, 2015 at 11:04:57PM +0100, Michael Niedermayer wrote: > Simply returning on failure without indicating failure does not work > it instead crashes later, its better to fail immedeately until the > failure is handled. > > Signed-off-by: Michael Niedermayer <michae...@gmx.at> > --- > libavfilter/formats.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/libavfilter/formats.c b/libavfilter/formats.c > index f25328c..9e19613 100644 > --- a/libavfilter/formats.c > +++ b/libavfilter/formats.c > @@ -416,8 +416,7 @@ AVFilterChannelLayouts *ff_all_channel_counts(void) > do { \ > *ref = f; \ > f->refs = av_realloc(f->refs, sizeof(*f->refs) * ++f->refcount); \ > - if (!f->refs) \ > - return; \ > + av_assert0(f->refs); \ > f->refs[f->refcount-1] = ref; \ > } while (0) >
this macro (FORMATS_REF) is used in ff_channel_layouts_ref() and ff_formats_ref(). Both of these are currently returning void, but both of them are also private, so there is nothing (AFAICT) that prevents changing their prototype and making them return int / AVERROR(ENOMEM). Asserting on the result of an alloc? Yeah, please don't. This sounds fixable properly without that much more efforts. -- Clément B.
pgp6OnS3v33Av.pgp
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel