lavc/libkvazaar: fix memory leak after av_dict_parse_string fail
authorJun Zhao <barryjzhao@tencent.com>
Wed, 1 Jan 2020 04:09:52 +0000 (12:09 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Sat, 4 Jan 2020 01:04:58 +0000 (09:04 +0800)
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>
libavcodec/libkvazaar.c

index a89ca7f..02bcae3 100644 (file)
@@ -110,8 +110,8 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
                            entry->key, entry->value);
                 }
             }
-            av_dict_free(&dict);
         }
+        av_dict_free(&dict);
     }
 
     ctx->encoder = enc = api->encoder_open(cfg);