diff mbox series

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

Message ID 1577856040-17409-3-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>
---
 libavcodec/librav1e.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c
index a5aedd5..13ebe53 100644
--- a/libavcodec/librav1e.c
+++ b/libavcodec/librav1e.c
@@ -254,8 +254,8 @@  static av_cold int librav1e_encode_init(AVCodecContext *avctx)
                 if (parse_ret < 0)
                     av_log(avctx, AV_LOG_WARNING, "Invalid value for %s: %s.\n", en->key, en->value);
             }
-            av_dict_free(&dict);
         }
+        av_dict_free(&dict);
     }
 
     rret = rav1e_config_parse_int(cfg, "width", avctx->width);