diff mbox series

[FFmpeg-devel,V1,05/12] lavc/libx264: fix memory leak after av_dict_parse_string fail

Message ID 1577856040-17409-5-git-send-email-mypopydev@gmail.com
State New
Headers show
Series [FFmpeg-devel,V1,01/12] lavc/bsf: fix memory leak after av_dict_parse_string fail
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork fail Failed to apply patch

Commit Message

Jun Zhao Jan. 1, 2020, 5:20 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/libx264.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index bfd91bb..b982ba7 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -903,9 +903,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
                            "Error parsing option '%s = %s'.\n",
                             en->key, en->value);
             }
-
-            av_dict_free(&dict);
         }
+        av_dict_free(&dict);
     }
 
     // update AVCodecContext with x264 parameters