]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/sinc: fix memory leak in error handling path
authorJun Zhao <barryjzhao@tencent.com>
Tue, 10 Sep 2019 10:50:11 +0000 (18:50 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Wed, 11 Sep 2019 02:36:34 +0000 (10:36 +0800)
free work&pi_wraps in error handling path to avoid memory leak.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
libavfilter/asrc_sinc.c

index 0135eb9023ba0da7fd1bc38742bd7a45c4ef2630..90f043d680d01d5b744eae2a41dcce5d8cc8eaae 100644 (file)
@@ -239,8 +239,11 @@ static int fir_to_phase(SincContext *s, float **h, int *len, int *post_len, floa
     s->rdft = s->irdft = NULL;
     s->rdft  = av_rdft_init(av_log2(work_len), DFT_R2C);
     s->irdft = av_rdft_init(av_log2(work_len), IDFT_C2R);
-    if (!s->rdft || !s->irdft)
+    if (!s->rdft || !s->irdft) {
+        av_free(pi_wraps);
+        av_free(work);
         return AVERROR(ENOMEM);
+    }
 
     av_rdft_calc(s->rdft, work);   /* Cepstral: */
     UNPACK(work, work_len);