summaryrefslogtreecommitdiff
path: root/libavfilter/vf_signature.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2017-06-11 15:29:35 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2017-06-13 19:49:39 +0200
commitfeb13aed794a7f1a1f8395159e9b077351348a34 (patch)
tree5dc14435a7e3143db874352d881aa0f205c3b512 /libavfilter/vf_signature.c
parenta5b5ce2658bf7506bb31f0b2b4cb44ddbf9a3955 (diff)
downloadffmpeg-feb13aed794a7f1a1f8395159e9b077351348a34.tar.gz
avfilter/vf_signature: fix memory leaks in error cases
Fixes CIDs 1403234 and 1403235
Diffstat (limited to 'libavfilter/vf_signature.c')
-rw-r--r--libavfilter/vf_signature.c5
1 files changed, 4 insertions, 1 deletions
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);