A string containing the segment's filename that the segment muxer
allocates got only freed in its write_trailer function. This implies
that it leaks if write_trailer is never called, e.g. if initializing
the child muxer fails. This commit fixes this by freeing the string
in the deinit function instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>
---
 libavformat/segment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index e30e47b62e..b8eb0289c4 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -665,6 +665,7 @@ static void seg_free(AVFormatContext *s)
     seg->avf = NULL;
     av_freep(&seg->times);
     av_freep(&seg->frames);
+    av_freep(&seg->cur_entry.filename);
 }
 
 static int seg_init(AVFormatContext *s)
@@ -993,7 +994,6 @@ fail:
         ff_format_io_close(s, &seg->list_pb);
 
     av_opt_free(seg);
-    av_freep(&seg->cur_entry.filename);
 
     cur = seg->segment_list_entries;
     while (cur) {
-- 
2.20.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to