[FFmpeg-devel] [PATCH 1/3] avcodec/utils: Fix off by 1 error causing unneeded allocation in ff_fast_malloc()

Michael Niedermayer michaelni at gmx.at
Mon Sep 29 12:57:59 CEST 2014


On Mon, Sep 29, 2014 at 09:59:21AM +0200, Benoit Fouet wrote:
> Hi,
> 
> ----- Mail original -----
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavcodec/utils.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> > index b27f918..9eb2b5b 100644
> > --- a/libavcodec/utils.c
> > +++ b/libavcodec/utils.c
> > @@ -122,7 +122,7 @@ static void *avformat_mutex;
> >  static inline int ff_fast_malloc(void *ptr, unsigned int *size,
> >  size_t min_size, int zero_realloc)
> >  {
> >      void **p = ptr;
> > -    if (min_size < *size)
> > +    if (min_size <= *size && *p)
> >          return 0;
> >      min_size = FFMAX(17 * min_size / 16 + 32, min_size);
> >      av_free(*p);
> > 
> 
> LGTM

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140929/f529f766/attachment.asc>


More information about the ffmpeg-devel mailing list