avformat/nutenc: use av_reallocp_array()

Fixes memleak on allocation error.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/36/head
Paul B Mahol 11 years ago
parent 6a70feadb0
commit f2afe96181
  1. 2
      libavformat/nutenc.c

@ -864,7 +864,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
for (i=0; i<s->nb_streams; i++) { for (i=0; i<s->nb_streams; i++) {
int j; int j;
StreamContext *nus = &nut->stream[i]; 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) if (!nus->keyframe_pts)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
for (j=nut->sp_count == 1 ? 0 : nut->sp_count; j<2*nut->sp_count; j++) for (j=nut->sp_count == 1 ? 0 : nut->sp_count; j<2*nut->sp_count; j++)

Loading…
Cancel
Save