[Ffmpeg-devel] [PATCH] Always link the faacDecClose() function - solves memory leak

Måns Rullgård mans
Sat Mar 17 17:08:52 CET 2007


Diego 'Flameeyes' Petten? <flameeyes at gmail.com> writes:

> The attached patch moves the load of Close() function from faacDecClose() 
> (both with libfaad linked in, and with libfaad dlopened) from inside the 
> #ifndef FAAD2_VERSION to the common case.
>
> The Close function is already declared outside the #ifndef clause, and it is 
> for sure present on FAAD 2.0, where FAAD2_VERSION is defined.
>
> Without this patch, valgrind shown a memory leak of about 60KB when playing 
> the start of an mp4 H264+aac file with ffplay (plus a series of 4KB less 
> certain leaks that also disappear with this patch).
>
> HTH,
> -- 
> Diego "Flameeyes" Petten?
> http://farragut.flameeyes.is-a-geek.org/
>
>
> Index: libavcodec/faad.c
> ===================================================================
> --- libavcodec/faad.c	(revision 8211)
> +++ libavcodec/faad.c	(working copy)
> @@ -228,6 +228,7 @@
>  
>          // resolve all needed function calls
>          dfaac(Open, (faacDecHandle FAADAPI (*)(void)));
> +        dfaac(Close, (void FAADAPI (*)(faacDecHandle hDecoder)));
>          dfaac(GetCurrentConfiguration, (faacDecConfigurationPtr
>                                          FAADAPI (*)(faacDecHandle)));
>  #ifndef FAAD2_VERSION
> @@ -239,7 +240,6 @@
>      dfaac(Init2, (int FAADAPI (*)(faacDecHandle, unsigned char*,
>                                         unsigned long, unsigned long*,
>                                         unsigned long*)));
> -    dfaac(Close, (void FAADAPI (*)(faacDecHandle hDecoder)));
>          dfaac(Decode, (int FAADAPI (*)(faacDecHandle, unsigned char*,
>                               unsigned long*, short*, unsigned long*)));
>  #else

With this change, the call of faacDecClose in faac_decode_end() can be
made unconditional.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list