Check for NULL ptr in malloc_usable_size().

Check for NULL ptr in malloc_usable_size(), rather than just asserting
that ptr is non-NULL.  This matches behavior of other implementations
(e.g., glibc and tcmalloc).
This commit is contained in:
Jason Evans 2012-03-26 13:13:55 -07:00
parent 5b3db098f7
commit 2465bdf493

View File

@ -1230,10 +1230,8 @@ je_malloc_usable_size(const void *ptr)
if (config_ivsalloc)
ret = ivsalloc(ptr);
else {
assert(ptr != NULL);
ret = isalloc(ptr);
}
else
ret = (ptr != NULL) ? isalloc(ptr) : 0;
return (ret);
}