avformat/nutenc: use av_reallocp_array()

Fixes memleak on allocation error.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2013-09-14 14:27:15 +00:00
parent 6a70feadb0
commit f2afe96181

View 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++)