[FFmpeg-devel] [PATCH] flacdec: fix memleaks

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Jul 29 19:11:09 CEST 2012

On Sun, Jul 29, 2012 at 06:37:34PM +0200, Nicolas George wrote:
> Le duodi 12 thermidor, an CCXX, Reimar Döffinger a écrit :
> >              if (!buffer) {
> > -                return AVERROR(ENOMEM);
> > +                ret = AVERROR(ENOMEM);
> > +                goto err_out;
> Maybe:
> #define RETURN_ERROR(code) do { ret = (code); goto err_out } while(0)
> ? If all functions follow the convention of calling the variable with the
> return value "ret" and the label for failure "err_out", it can serve for the
> whole file. And it will make the code more agreeable to read IMHO.

Macros also have a cost in that they need to be understood before you
can understand the code, especially when they are not self-contained like here.
A FFmpeg-wide macro maybe would make sense if we can use it in a lot of
places (though I doubt it saves all that much, plus RETURN_ERROR(ret)
would probably cause compiler warnings so you couldn't use it completely
consistently), but for a single file IMHO it does not save enough
to justify the "obfuscation".
Anyway, enough bike-shedding, I don't really care what/how it is done,
as long as the final state is that we do not have frees peppered all

More information about the ffmpeg-devel mailing list