[FFmpeg-devel] [PATCH 2/5] avfilter/formats: use av_realloc_array in ADD_FORMAT()

Clément Bœsch u at pkh.me
Mon Mar 16 23:45:29 CET 2015


On Sun, Mar 15, 2015 at 03:01:55PM +0100, Stefano Sabatini wrote:
> On date Sunday 2015-03-15 14:24:27 +0100, Clément Bœsch encoded:
> > ---
> >  libavfilter/formats.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> > index 1fc7fa6..896ceeb 100644
> > --- a/libavfilter/formats.c
> > +++ b/libavfilter/formats.c
> > @@ -308,8 +308,8 @@ do {                                                        \
> >      if (!(*f) && !(*f = av_mallocz(sizeof(**f))))           \
> >          return AVERROR(ENOMEM);                             \
> >                                                              \
> > -    fmts = av_realloc((*f)->list,                           \
> > -                      sizeof(*(*f)->list) * ((*f)->nb + 1));\
> > +    fmts = av_realloc_array((*f)->list, (*f)->nb + 1,       \
> > +                            sizeof(*(*f)->list));           \
> >      if (!fmts) {                                            \
> >          if (!oldf)                                          \
> >              av_freep(f);                                    \
> 
> LGTM.

Pushed, thanks

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150316/cf24eed8/attachment.asc>


More information about the ffmpeg-devel mailing list