diff mbox series

[FFmpeg-devel,V1,09/12] lavf/dashenc: fix memory leak after av_dict_parse_string fail

Message ID 1577856040-17409-9-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 | expand

Checks

Context Check Description
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>
---
 libavformat/dashenc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 8c28fb6..c37678d 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1305,8 +1305,10 @@  static int dash_init(AVFormatContext *s)
 
         if (c->format_options_str) {
             ret = av_dict_parse_string(&opts, c->format_options_str, "=", ":", 0);
-            if (ret < 0)
+            if (ret < 0) {
+                av_dict_free(&opts);
                 return ret;
+            }
         }
 
         if (os->segment_type == SEGMENT_TYPE_MP4) {