summaryrefslogtreecommitdiff
path: root/libavfilter/vf_coreimage.m
diff options
context:
space:
mode:
authorJun Zhao <barryjzhao@tencent.com>2020-01-01 12:27:18 +0800
committerJun Zhao <barryjzhao@tencent.com>2020-01-04 09:05:09 +0800
commitc8e72a6494ebffbe930a30823cb70a0671e6bfe0 (patch)
tree48c100b3dcec679e1aefaaaec64d216624205a8a /libavfilter/vf_coreimage.m
parentcf9c9a9db93ac5158ad77ba7f6d23493d7e8e222 (diff)
downloadffmpeg-c8e72a6494ebffbe930a30823cb70a0671e6bfe0.tar.gz
lavfi/coreimage: fix memory leak after av_dict_parse_string fail
In case of failure, all the successfully set entries are stored in *pm. We need to manually free the created dictionary to avoid memory leak. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Diffstat (limited to 'libavfilter/vf_coreimage.m')
-rw-r--r--libavfilter/vf_coreimage.m2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 323a28caa1..4ed5ba7920 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -486,6 +486,7 @@ static av_cold int init(AVFilterContext *fctx)
av_log(ctx, AV_LOG_DEBUG, "Filter_string: %s\n", ctx->filter_string);
ret = av_dict_parse_string(&filter_dict, ctx->filter_string, "@", "#", AV_DICT_MULTIKEY); // parse filter_name:all_filter_options
if (ret) {
+ av_dict_free(&filter_dict);
av_log(ctx, AV_LOG_ERROR, "Parsing of filters failed.\n");
return AVERROR(EIO);
}
@@ -507,6 +508,7 @@ static av_cold int init(AVFilterContext *fctx)
if (strncmp(f->value, "default", 7)) { // not default
ret = av_dict_parse_string(&filter_options, f->value, "=", "@", 0); // parse option_name:option_value
if (ret) {
+ av_dict_free(&filter_options);
av_log(ctx, AV_LOG_ERROR, "Parsing of filter options for \"%s\" failed.\n", f->key);
return AVERROR(EIO);
}