[FFmpeg-devel] [PATCH] flacdec: fix memleaks
Reimar.Doeffinger at gmx.de
Sun Jul 29 17:55:58 CEST 2012
On Sun, Jul 29, 2012 at 03:36:28PM +0000, Paul B Mahol wrote:
> On 7/29/12, Reimar Doeffinger <Reimar.Doeffinger at gmx.de> wrote:
> > On Sun, Jul 29, 2012 at 02:14:12PM +0000, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> > Thanks, but could you please use goto instead?
> > This is quite a lot of code duplication, and if someone e.g. adds a second
> > buffer that needs to be freed there's a good chance they'll miss to add
> > it at some places.
> Use goto only for this specific case or for all cases?
Not sure I understand the question.
Ideally IMHO all functions that need something freed should have at most
two return statements: one for the success and one for the failure case.
goto usually is the most convenient way of achieving that.
More information about the ffmpeg-devel