diff options
author | Lvqier <lvqier@gmail.com> | 2015-12-08 19:29:13 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-12 23:19:22 +0100 |
commit | 93d336fb076a8abe33e37251af5475673e716f6d (patch) | |
tree | de7a93e8be23b02c6c0d298fdd6da298346c4211 /libavformat | |
parent | 7dc469f3423e074b6fb46827b6008c18b7f2d500 (diff) | |
download | ffmpeg-93d336fb076a8abe33e37251af5475673e716f6d.tar.gz |
avformat/segment: Fix memory leak of cur_entry.filename
Solution suggested-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/segment.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c index 8432d0fec5..0c1f6336ae 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -183,6 +183,7 @@ static int set_segment_filename(AVFormatContext *s) SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; size_t size; + int ret; if (seg->segment_idx_wrap) seg->segment_idx %= seg->segment_idx_wrap; @@ -206,9 +207,8 @@ static int set_segment_filename(AVFormatContext *s) if (seg->entry_prefix) size += strlen(seg->entry_prefix); - seg->cur_entry.filename = av_mallocz(size); - if (!seg->cur_entry.filename) - return AVERROR(ENOMEM); + if ((ret = av_reallocp(&seg->cur_entry.filename, size)) < 0) + return ret; snprintf(seg->cur_entry.filename, size, "%s%s", seg->entry_prefix ? seg->entry_prefix : "", av_basename(oc->filename)); |