mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
avutil/mem: Also poison new av_realloc-allocated blocks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
4796ec5d4e
commit
8b83a4a885
@ -133,14 +133,20 @@ void *av_malloc(size_t size)
|
|||||||
|
|
||||||
void *av_realloc(void *ptr, size_t size)
|
void *av_realloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
|
void *ret;
|
||||||
if (size > max_alloc_size)
|
if (size > max_alloc_size)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#if HAVE_ALIGNED_MALLOC
|
#if HAVE_ALIGNED_MALLOC
|
||||||
return _aligned_realloc(ptr, size + !size, ALIGN);
|
ret = _aligned_realloc(ptr, size + !size, ALIGN);
|
||||||
#else
|
#else
|
||||||
return realloc(ptr, size + !size);
|
ret = realloc(ptr, size + !size);
|
||||||
#endif
|
#endif
|
||||||
|
#if CONFIG_MEMORY_POISONING
|
||||||
|
if (ret && !ptr)
|
||||||
|
memset(ret, FF_MEMORY_POISON, size);
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
|
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user