зеркало из https://github.com/microsoft/snmalloc.git
realloc: ASSUME non-NULL source pointer for memcpy
NULL has size zero, which rounds up to zero, and so would have been handled.
This commit is contained in:
Родитель
640cacf90e
Коммит
f3e470c3e4
|
@ -74,7 +74,10 @@ namespace snmalloc::libc
|
|||
// Guard memcpy as GCC is assuming not nullptr for ptr after the memcpy
|
||||
// otherwise.
|
||||
if (SNMALLOC_UNLIKELY(sz != 0))
|
||||
{
|
||||
SNMALLOC_ASSUME(ptr != nullptr);
|
||||
::memcpy(p, ptr, sz);
|
||||
}
|
||||
a.dealloc(ptr);
|
||||
}
|
||||
else if (SNMALLOC_LIKELY(size == 0))
|
||||
|
|
Загрузка…
Ссылка в новой задаче