From 8e4abfbb9dbc6ff192926e4d6befef40897a5479 Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 21 Mar 2017 12:03:44 -0300 Subject: [PATCH] swresample/resample: free existing ResampleContext on reinit Fixes memleak. Reviewed-by: wm4 Reviewed-by: Michael Niedermayer Signed-off-by: James Almer (cherry picked from commit db7a05dab0652d4ec6d89394c9024d02f44494a7) --- libswresample/resample.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libswresample/resample.c b/libswresample/resample.c index 2e161b19ce..e7c9e730fb 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -328,6 +328,7 @@ static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_r if (!c || c->phase_count != phase_count || c->linear!=linear || c->factor != factor || c->filter_length != FFMAX((int)ceil(filter_size/factor), 1) || c->format != format || c->filter_type != filter_type || c->kaiser_beta != kaiser_beta) { + resample_free(&c); c = av_mallocz(sizeof(*c)); if (!c) return NULL;