mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-29 10:43:15 +00:00
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>
This commit is contained in:
parent
936d967871
commit
3152a2a218
@ -664,6 +664,7 @@ static void seg_free(AVFormatContext *s)
|
|||||||
seg->avf = NULL;
|
seg->avf = NULL;
|
||||||
av_freep(&seg->times);
|
av_freep(&seg->times);
|
||||||
av_freep(&seg->frames);
|
av_freep(&seg->frames);
|
||||||
|
av_freep(&seg->cur_entry.filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int seg_init(AVFormatContext *s)
|
static int seg_init(AVFormatContext *s)
|
||||||
@ -983,7 +984,6 @@ fail:
|
|||||||
ff_format_io_close(s, &seg->list_pb);
|
ff_format_io_close(s, &seg->list_pb);
|
||||||
|
|
||||||
av_opt_free(seg);
|
av_opt_free(seg);
|
||||||
av_freep(&seg->cur_entry.filename);
|
|
||||||
|
|
||||||
cur = seg->segment_list_entries;
|
cur = seg->segment_list_entries;
|
||||||
while (cur) {
|
while (cur) {
|
||||||
|
Loading…
Reference in New Issue
Block a user