diff mbox series

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

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

Patch

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 963c28f..3836049 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -262,8 +262,8 @@  static av_cold int libx265_encode_init(AVCodecContext *avctx)
                     break;
                 }
             }
-            av_dict_free(&dict);
         }
+        av_dict_free(&dict);
     }
 
     if (ctx->params->rc.vbvBufferSize && avctx->rc_initial_buffer_occupancy > 1000 &&