diff --git a/libavformat/ogg2.c b/libavformat/ogg2.c index c54b2a04c5..065d3bc0a6 100644 --- a/libavformat/ogg2.c +++ b/libavformat/ogg2.c @@ -80,7 +80,7 @@ ogg_save (AVFormatContext * s) { ogg_t *ogg = s->priv_data; ogg_state_t *ost = - av_malloc(sizeof (*ost) + ogg->nstreams * sizeof (*ogg->streams)); + av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams)); int i; ost->pos = url_ftell (&s->pb);; ost->curidx = ogg->curidx; diff --git a/libavformat/ogg2.h b/libavformat/ogg2.h index b1146e314c..f397a57197 100644 --- a/libavformat/ogg2.h +++ b/libavformat/ogg2.h @@ -55,7 +55,7 @@ typedef struct ogg_state { uint64_t pos; int curidx; struct ogg_state *next; - ogg_stream_t streams[]; + ogg_stream_t streams[1]; } ogg_state_t; typedef struct ogg {