[FFmpeg-cvslog] swresample/resample: free existing ResampleContext on reinit

James Almer git at videolan.org
Tue Mar 21 17:23:21 EET 2017


ffmpeg | branch: release/3.2 | James Almer <jamrial at gmail.com> | Tue Mar 21 12:03:44 2017 -0300| [2bf28b9db6e7c3137d73dfc60139e4d62b010145] | committer: James Almer

swresample/resample: free existing ResampleContext on reinit

Fixes memleak.

Reviewed-by: wm4 <nfxjfg at googlemail.com>
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit db7a05dab0652d4ec6d89394c9024d02f44494a7)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2bf28b9db6e7c3137d73dfc60139e4d62b010145
---

 libswresample/resample.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libswresample/resample.c b/libswresample/resample.c
index c9b112d..46e5a26 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -330,6 +330,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;



More information about the ffmpeg-cvslog mailing list