aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-05 21:22:21 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-27 07:21:00 +0100
commit021e1aa6b84f0c81fa0aadbdffde3f6655a676eb (patch)
tree80750f30e1dc77d17e95022484619fd583afedaa
parent2c8f99deb8c23ece3b821ef3a3ec29cade99d1ce (diff)
downloadffmpeg-021e1aa6b84f0c81fa0aadbdffde3f6655a676eb.tar.gz
avformat/segment: Fix leak of string on error
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. Reviewed-by: Ridley Combs <rcombs@rcombs.me> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit 3152a2a218578ad3c024dcd7d4ced06b396d30e1)
-rw-r--r--libavformat/segment.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 3b7ccc9be2..e9ecc01349 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -664,6 +664,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)
@@ -983,7 +984,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) {