History

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.

Jun Zhao committed 6 years ago

Commit c8e72a61 parent cf9c9a91 file · +2 −0Browse files

Unified · Split

libavfilter/vf_coreimage.m+2−0
@@ -486,6 +486,7 @@ static av_cold int init(AVFilterContext *fctx) · 485 unmodified lines
486486 av_log(ctx, AV_LOG_DEBUG, "Filter_string: %s\n", ctx->filter_string);
487487 ret = av_dict_parse_string(&filter_dict, ctx->filter_string, "@", "#", AV_DICT_MULTIKEY); // parse filter_name:all_filter_options
488488 if (ret) {
489+ av_dict_free(&filter_dict);
489490 av_log(ctx, AV_LOG_ERROR, "Parsing of filters failed.\n");
490491 return AVERROR(EIO);
491492 }
@@ -507,6 +508,7 @@ static av_cold int init(AVFilterContext *fctx) · 15 unmodified lines
507508 if (strncmp(f->value, "default", 7)) { // not default
508509 ret = av_dict_parse_string(&filter_options, f->value, "=", "@", 0); // parse option_name:option_value
509510 if (ret) {
511+ av_dict_free(&filter_options);
510512 av_log(ctx, AV_LOG_ERROR, "Parsing of filter options for \"%s\" failed.\n", f->key);
511513 return AVERROR(EIO);
512514 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t