Message ID | AM7PR03MB6660ED33B3DB5174C6A9C4908FF79@AM7PR03MB6660.eurprd03.prod.outlook.com |
---|---|
State | Accepted |
Commit | 26aa844a214388b775839cc1ae06c97e695b464a |
Headers | show |
Series | [FFmpeg-devel,1/2] avformat/oggdec: Use av_realloc_array() | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> > --- > This also removes the last user of av_size_mult from libavformat > (indeed, from anything outside of mem.c), so this removes one entry > from the list of dynamic symbols (if using a shared build). > > libavformat/oggdec.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c > index bb289e0756..5afbae2147 100644 > --- a/libavformat/oggdec.c > +++ b/libavformat/oggdec.c > @@ -251,7 +251,6 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) > int idx = ogg->nstreams; > AVStream *st; > struct ogg_stream *os; > - size_t size; > > if (ogg->state) { > av_log(s, AV_LOG_ERROR, "New streams are not supposed to be added " > @@ -260,8 +259,8 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) > } > > /* Allocate and init a new Ogg Stream */ > - if (av_size_mult(ogg->nstreams + 1, sizeof(*ogg->streams), &size) < 0 || > - !(os = av_realloc(ogg->streams, size))) > + if (!(os = av_realloc_array(ogg->streams, ogg->nstreams + 1, > + sizeof(*ogg->streams)))) > return AVERROR(ENOMEM); > ogg->streams = os; > os = ogg->streams + idx; > Will apply this patchset later today unless there are objections. - Andreas
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index bb289e0756..5afbae2147 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -251,7 +251,6 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) int idx = ogg->nstreams; AVStream *st; struct ogg_stream *os; - size_t size; if (ogg->state) { av_log(s, AV_LOG_ERROR, "New streams are not supposed to be added " @@ -260,8 +259,8 @@ static int ogg_new_stream(AVFormatContext *s, uint32_t serial) } /* Allocate and init a new Ogg Stream */ - if (av_size_mult(ogg->nstreams + 1, sizeof(*ogg->streams), &size) < 0 || - !(os = av_realloc(ogg->streams, size))) + if (!(os = av_realloc_array(ogg->streams, ogg->nstreams + 1, + sizeof(*ogg->streams)))) return AVERROR(ENOMEM); ogg->streams = os; os = ogg->streams + idx;
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- This also removes the last user of av_size_mult from libavformat (indeed, from anything outside of mem.c), so this removes one entry from the list of dynamic symbols (if using a shared build). libavformat/oggdec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)