[FFmpeg-devel] [PATCH 1/2] avfilter/all: propagate errors of functions from avfilter/formats
Ronald S. Bultje
rsbultje at gmail.com
Tue Oct 6 17:00:41 CEST 2015
Hi,
On Tue, Oct 6, 2015 at 9:25 AM, Nicolas George <george at nsup.org> wrote:
> Le quintidi 15 vendémiaire, an CCXXIV, Ronald S. Bultje a écrit :
> > > // inlink supports any channel layout
> > > layouts = ff_all_channel_counts();
> > > - ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts);
> > > + if (!layouts)
> > > + return AVERROR(ENOMEM);
> > > + if ((ret = ff_channel_layouts_ref(layouts,
> > &inlink->out_channel_layouts)) < 0) {
> > > + ff_channel_layouts_unref(&layouts);
> > > + return ret;
> > > + }
>
> > I already feel fully inadequate to review this patch :-D. But this looks
> > weird.
>
> What do you find weird in this change?
It seems to me that unref is the counterpart of ref. If ref fails, it
should behave as if it never occurred; compare not having to call free when
malloc fails, or not having to call avformat_close when avformat_open_input
fails. However, here, it seems we call unref if ref fails.
Why?
Is unref not the counterpart of ref?
Does ref not clean up after itself when it fails?
Something else?
Ronald
More information about the ffmpeg-devel
mailing list