[FFmpeg-devel] [PATCH V1 09/12] lavf/dashenc: fix memory leak after av_dict_parse_string fail
Jun Zhao
mypopydev at gmail.com
Wed Jan 1 07:20:37 EET 2020
From: Jun Zhao <barryjzhao at 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 at tencent.com>
---
libavformat/dashenc.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
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) {
--
1.7.1
More information about the ffmpeg-devel
mailing list