Commit 8ba69454 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/utils: Fix off by 1 error causing unneeded allocation in ff_fast_malloc()

Reviewed-by: 's avatarBenoit Fouet <benoit.fouet@free.fr>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 3f5095f2
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment