OSDN Git Service

allocate enough bytes
authorMike Melanson <mike@multimedia.cx>
Mon, 26 May 2003 20:53:09 +0000 (20:53 +0000)
committerMike Melanson <mike@multimedia.cx>
Mon, 26 May 2003 20:53:09 +0000 (20:53 +0000)
Originally committed as revision 1908 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/4xm.c

index c1d5f67..b45fd05 100644 (file)
@@ -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;