avutil/mem: fix memleak

The original code assumes av_realloc() will free ptr if size is zero.
The assumes is incorrect now.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Zhao Zhili 2016-07-19 00:30:54 +08:00 committed by Michael Niedermayer
parent d7ae4f79d3
commit 65b2feb890

View File

@ -179,7 +179,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
return NULL;
}
r = av_realloc(ptr, size);
if (!r && size)
if (!r)
av_free(ptr);
return r;
}