[FFmpeg-cvslog] avformat/segment: Fix memory leak of cur_entry.filename
Lvqier
git at videolan.org
Sat Dec 12 23:24:27 CET 2015
ffmpeg | branch: master | Lvqier <lvqier at gmail.com> | Tue Dec 8 19:29:13 2015 +0800| [93d336fb076a8abe33e37251af5475673e716f6d] | committer: Michael Niedermayer
avformat/segment: Fix memory leak of cur_entry.filename
Solution suggested-by: Hendrik Leppkes <h.leppkes at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=93d336fb076a8abe33e37251af5475673e716f6d
---
libavformat/segment.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 8432d0f..0c1f633 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));
More information about the ffmpeg-cvslog
mailing list