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.
Unified · Split
| @@ -486,6 +486,7 @@ static av_cold int init(AVFilterContext *fctx) · 485 unmodified lines | ||
| 486 | 486 | av_log(ctx, AV_LOG_DEBUG, "Filter_string: %s\n", ctx->filter_string); |
| 487 | 487 | ret = av_dict_parse_string(&filter_dict, ctx->filter_string, "@", "#", AV_DICT_MULTIKEY); // parse filter_name:all_filter_options |
| 488 | 488 | if (ret) { |
| 489 | + av_dict_free(&filter_dict); | |
| 489 | 490 | av_log(ctx, AV_LOG_ERROR, "Parsing of filters failed.\n"); |
| 490 | 491 | return AVERROR(EIO); |
| 491 | 492 | } |
| @@ -507,6 +508,7 @@ static av_cold int init(AVFilterContext *fctx) · 15 unmodified lines | ||
| 507 | 508 | if (strncmp(f->value, "default", 7)) { // not default |
| 508 | 509 | ret = av_dict_parse_string(&filter_options, f->value, "=", "@", 0); // parse option_name:option_value |
| 509 | 510 | if (ret) { |
| 511 | + av_dict_free(&filter_options); | |
| 510 | 512 | av_log(ctx, AV_LOG_ERROR, "Parsing of filter options for \"%s\" failed.\n", f->key); |
| 511 | 513 | return AVERROR(EIO); |
| 512 | 514 | } |