[FFmpeg-cvslog] avfilter/vf_signature: fix memory leaks in error cases

Timo Rothenpieler git at videolan.org
Tue Jun 13 20:53:20 EEST 2017


ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Sun Jun 11 15:29:35 2017 +0200| [feb13aed794a7f1a1f8395159e9b077351348a34] | committer: Timo Rothenpieler

avfilter/vf_signature: fix memory leaks in error cases

Fixes CIDs 1403234 and 1403235

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

 libavfilter/vf_signature.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
index 06b1b910d4..f0078ba1a6 100644
--- a/libavfilter/vf_signature.c
+++ b/libavfilter/vf_signature.c
@@ -260,8 +260,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
         if (!elemsignature)
             return AVERROR(ENOMEM);
         sortsignature = av_malloc_array(elemcat->elem_count, sizeof(int64_t));
-        if (!sortsignature)
+        if (!sortsignature) {
+            av_freep(&elemsignature);
             return AVERROR(ENOMEM);
+        }
 
         for (j = 0; j < elemcat->elem_count; j++) {
             blocksum = 0;
@@ -508,6 +510,7 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi
         char buf[128];
         av_strerror(err, buf, sizeof(buf));
         av_log(ctx, AV_LOG_ERROR, "cannot open file %s: %s\n", filename, buf);
+        av_freep(&buffer);
         return err;
     }
     init_put_bits(&buf, buffer, len);



More information about the ffmpeg-cvslog mailing list