diff mbox series

[FFmpeg-devel,V2,1/5] lavc/bsf: fix memory leak after av_dict_parse_string fail

Message ID 1577966105-4642-1-git-send-email-mypopydev@gmail.com
State New
Headers show
Series [FFmpeg-devel,V2,1/5] lavc/bsf: fix memory leak after av_dict_parse_string fail
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Jun Zhao Jan. 2, 2020, 11:55 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

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/bsf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Michael Niedermayer Jan. 2, 2020, 11:28 p.m. UTC | #1
On Thu, Jan 02, 2020 at 07:55:01PM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> 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/bsf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c
index c1653cd..8e1af60 100644
--- a/libavcodec/bsf.c
+++ b/libavcodec/bsf.c
@@ -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;
 }