[FFmpeg-devel] [PATCH 2/3] avformat/hlsenc: fix filename memleak in hls_write_packet

Steven Liu lq at chinaffmpeg.org
Fri May 8 13:33:58 EEST 2020


Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
---
 libavformat/hlsenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index bcc67b1159..307aba2efa 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -2447,6 +2447,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                     av_log(s, hls->ignore_io_errors ? AV_LOG_WARNING : AV_LOG_ERROR,
                            "Failed to open file '%s'\n", filename);
                     av_dict_free(&options);
+                    av_freep(&filename);
                     return hls->ignore_io_errors ? 0 : ret;
                 }
                 if (hls->segment_type == SEGMENT_TYPE_FMP4) {
@@ -2454,6 +2455,7 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
                 }
                 ret = flush_dynbuf(vs, &range_length);
                 if (ret < 0) {
+                    av_freep(&filename);
                     av_dict_free(&options);
                     return ret;
                 }
-- 
2.25.0





More information about the ffmpeg-devel mailing list