[FFmpeg-cvslog] avformat/nutenc: use av_reallocp_array()

Paul B Mahol git at videolan.org
Sat Sep 14 18:17:11 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Sep 14 14:27:15 2013 +0000| [f2afe96181a85e04294379583b77b1f07b9013d6] | committer: Paul B Mahol

avformat/nutenc: use av_reallocp_array()

Fixes memleak on allocation error.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2afe96181a85e04294379583b77b1f07b9013d6
---

 libavformat/nutenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 365b463..f24813b 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -864,7 +864,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
             for (i=0; i<s->nb_streams; i++) {
                 int j;
                 StreamContext *nus = &nut->stream[i];
-                nus->keyframe_pts = av_realloc(nus->keyframe_pts, 2*nut->sp_count*sizeof(*nus->keyframe_pts));
+                av_reallocp_array(&nus->keyframe_pts, 2*nut->sp_count, sizeof(*nus->keyframe_pts));
                 if (!nus->keyframe_pts)
                     return AVERROR(ENOMEM);
                 for (j=nut->sp_count == 1 ? 0 : nut->sp_count; j<2*nut->sp_count; j++)



More information about the ffmpeg-cvslog mailing list