From 944d76a3e056c26bfa2b6459ec1888f0676a37f2 Mon Sep 17 00:00:00 2001 From: Jun Zhao Date: Tue, 10 Sep 2019 18:50:11 +0800 Subject: lavfi/sinc: fix memory leak in error handling path free work&pi_wraps in error handling path to avoid memory leak. Reviewed-by: Paul B Mahol Signed-off-by: Jun Zhao --- libavfilter/asrc_sinc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libavfilter/asrc_sinc.c') diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c index 0135eb9023..90f043d680 100644 --- a/libavfilter/asrc_sinc.c +++ b/libavfilter/asrc_sinc.c @@ -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); -- cgit v1.2.3