]> git.sesse.net Git - ffmpeg/commitdiff
lavc/bsf: fix memory leak after av_dict_parse_string fail
authorJun Zhao <barryjzhao@tencent.com>
Wed, 1 Jan 2020 04:06:47 +0000 (12:06 +0800)
committerJun Zhao <barryjzhao@tencent.com>
Sat, 4 Jan 2020 01:03:30 +0000 (09:03 +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.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
libavcodec/bsf.c

index c1653cddb034cdbcaf339267bde97ab0d1585546..8e1af6082bc6b78a26be49605720ae2f7fb238f7 100644 (file)
@@ -517,8 +517,8 @@ static int bsf_parse_single(const char *str, AVBSFList *bsf_lst)
 
     ret = av_bsf_list_append2(bsf_lst, bsf_name, &bsf_options);
 
-    av_dict_free(&bsf_options);
 end:
+    av_dict_free(&bsf_options);
     av_free(buf);
     return ret;
 }