[pulseaudio-discuss] [PATCH] Resampler: Fix a memory leak in pa_resampler_ffmpeg_init()

Arun Raghavan arun at arunraghavan.net
Fri May 13 08:55:04 UTC 2016


On Fri, 13 May 2016, at 02:16 PM, Sachin Kumar Chauhan wrote:
> ffmpeg_data was not freed properly before return due to error.
> It is now freed properly.
> 
> BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=95347
> 
> Signed-off-by: Sachin Kumar Chauhan <sachin.kc at samsung.com>
> ---
>  src/pulsecore/resampler/ffmpeg.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/pulsecore/resampler/ffmpeg.c
> b/src/pulsecore/resampler/ffmpeg.c
> index 691bdd4..598af42 100644
> --- a/src/pulsecore/resampler/ffmpeg.c
> +++ b/src/pulsecore/resampler/ffmpeg.c
> @@ -120,7 +120,10 @@ int pa_resampler_ffmpeg_init(pa_resampler *r) {
>       * here for now as well until ffmpeg makes this configurable. */
>  
>      if (!(ffmpeg_data->state = av_resample_init((int) r->o_ss.rate,
>      (int) r->i_ss.rate, 16, 10, 0, 0.8)))
> +    {
> +        pa_xfree(ffmpeg_data);
>          return -1;
> +    }

Pushed with some style changes. Please see the differences and keep them
in mind for future patches.

-- Arun


More information about the pulseaudio-discuss mailing list