mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
cf9c9a9db9
commit
c8e72a6494
@ -486,6 +486,7 @@ static av_cold int init(AVFilterContext *fctx)
|
|||||||
av_log(ctx, AV_LOG_DEBUG, "Filter_string: %s\n", ctx->filter_string);
|
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
|
ret = av_dict_parse_string(&filter_dict, ctx->filter_string, "@", "#", AV_DICT_MULTIKEY); // parse filter_name:all_filter_options
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
av_dict_free(&filter_dict);
|
||||||
av_log(ctx, AV_LOG_ERROR, "Parsing of filters failed.\n");
|
av_log(ctx, AV_LOG_ERROR, "Parsing of filters failed.\n");
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
@ -507,6 +508,7 @@ static av_cold int init(AVFilterContext *fctx)
|
|||||||
if (strncmp(f->value, "default", 7)) { // not default
|
if (strncmp(f->value, "default", 7)) { // not default
|
||||||
ret = av_dict_parse_string(&filter_options, f->value, "=", "@", 0); // parse option_name:option_value
|
ret = av_dict_parse_string(&filter_options, f->value, "=", "@", 0); // parse option_name:option_value
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
av_dict_free(&filter_options);
|
||||||
av_log(ctx, AV_LOG_ERROR, "Parsing of filter options for \"%s\" failed.\n", f->key);
|
av_log(ctx, AV_LOG_ERROR, "Parsing of filter options for \"%s\" failed.\n", f->key);
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user