[FFmpeg-devel] [PATCH 2/2] Use av_fast_malloc instead of av_realloc. This should be faster, is less code and fixes issue 2524 (allocation error would lead to crash). (cherry picked from commit e7b95918fca1c3d057d35f77ba58ee2d00d03151)

İsmail Dönmez ismail
Mon Jan 24 21:06:15 CET 2011


Hi;

On Mon, Jan 24, 2011 at 10:03 PM, Luca Barbato <lu_zero at gentoo.org> wrote:

> On 01/24/2011 08:59 PM, Janne Grunau wrote:
> > -        c->decomp_size = c->height * c->width * 3 / 2;
> > -        c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size +
> AV_LZO_OUTPUT_PADDING);
> > +        av_fast_malloc(&c->decomp_buf, &c->decomp_size, c->height *
> c->width * 3 / 2);
>
> when decomp_size is updated then?
>
>
av_fast_malloc does set it;

void av_fast_malloc(void *ptr, unsigned int *size, FF_INTERNALC_MEM_TYPE
min_size)
{
    [...]
    *size= min_size;
}

Regards,
ismail



More information about the ffmpeg-devel mailing list