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

Sachin Kumar Chauhan sachin.kc at samsung.com
Fri May 13 08:46:16 UTC 2016


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;
+    }
 
     r->impl.free = ffmpeg_free;
     r->impl.resample = ffmpeg_resample;
-- 
1.9.1



More information about the pulseaudio-discuss mailing list