From 5a634a69521ce53b1e6535ab0de5c1608b8060a8 Mon Sep 17 00:00:00 2001 From: Mike Melanson Date: Mon, 26 May 2003 20:53:09 +0000 Subject: [PATCH] allocate enough bytes Originally committed as revision 1908 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/4xm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index c1d5f67e8c..b45fd05b1d 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -151,8 +151,9 @@ static int fourxm_read_header(AVFormatContext *s, } current_track = LE_32(&header[i + 8]); if (current_track + 1 > fourxm->track_count) { - fourxm->track_count++; - fourxm->tracks = av_realloc(fourxm->tracks, fourxm->track_count); + fourxm->track_count = current_track + 1; + fourxm->tracks = av_realloc(fourxm->tracks, + fourxm->track_count * sizeof(AudioTrack)); if (!fourxm->tracks) { av_free(header); return AVERROR_NOMEM;