[FFmpeg-devel] [PATCH v2] avformat/hls: release mem resource to fix memleak

Aman Gupta ffmpeg at tmm1.net
Sun Dec 31 07:50:17 EET 2017


From: Steven Liu <lq at chinaffmpeg.org>

fix CID: 1426991

Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
Signed-off-by: Aman Gupta <aman at tmm1.net>
---
 libavformat/hls.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index d9f7c6de4d..950cc4c3bd 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1473,8 +1473,11 @@ reload:
 
     if (c->http_multiple == -1) {
         uint8_t *http_version_opt = NULL;
-        av_opt_get(v->input, "http_version", AV_OPT_SEARCH_CHILDREN, &http_version_opt);
-        c->http_multiple = http_version_opt && strncmp((const char *)http_version_opt, "1.1", 3) == 0;
+        int r = av_opt_get(v->input, "http_version", AV_OPT_SEARCH_CHILDREN, &http_version_opt);
+        if (r >= 0) {
+            c->http_multiple = strncmp((const char *)http_version_opt, "1.1", 3) == 0;
+            av_freep(&http_version_opt);
+        }
     }
 
     seg = next_segment(v);
-- 
2.14.2



More information about the ffmpeg-devel mailing list