Files
scylladb/core/memory.cc
Avi Kivity 1f80f7ee14 memory: fix realloc()
Because memcpy() is declared by gcc as receiving non-null attributes, gcc
assumes that ptr != null, as it is passed into memcpy() (though with a size
of zero).  As a result it ignores the null pointer check in ::free(), and
calls memory::free() directly, which does not expect a null pointer.

Fix by only calling memcpy() when the ptr is non-null.
2014-10-23 15:59:52 +03:00

24 KiB