diff --git a/src/snmalloc/override/libc.h b/src/snmalloc/override/libc.h index 05a82ec..a7fd211 100644 --- a/src/snmalloc/override/libc.h +++ b/src/snmalloc/override/libc.h @@ -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)) @@ -174,4 +177,4 @@ namespace snmalloc::libc *memptr = p; return 0; } -} // namespace snmalloc::libc \ No newline at end of file +} // namespace snmalloc::libc