From 6603ee8563760f7a5c09b17da69b54d7e0da490e Mon Sep 17 00:00:00 2001 From: Sachin Kumar Chauhan Date: Fri, 13 May 2016 14:16:16 +0530 Subject: resampler: Fix a memory leak in pa_resampler_ffmpeg_init() 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 Signed-off-by: Arun Raghavan --- src/pulsecore/resampler/ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pulsecore/resampler/ffmpeg.c b/src/pulsecore/resampler/ffmpeg.c index 691bdd4b4..388b555af 100644 --- a/src/pulsecore/resampler/ffmpeg.c +++ b/src/pulsecore/resampler/ffmpeg.c @@ -119,8 +119,10 @@ int pa_resampler_ffmpeg_init(pa_resampler *r) { * internally only uses these hardcoded values, so let's use them * 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))) + 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; + } r->impl.free = ffmpeg_free; r->impl.resample = ffmpeg_resample; -- cgit v1.2.3