avformat/nutenc: use av_reallocp_array()
authorPaul B Mahol <onemda@gmail.com>
Sat, 14 Sep 2013 14:27:15 +0000 (14:27 +0000)
committerPaul B Mahol <onemda@gmail.com>
Sat, 14 Sep 2013 16:14:43 +0000 (16:14 +0000)
Fixes memleak on allocation error.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/nutenc.c

index 365b463..f24813b 100644 (file)
@@ -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++)