Changing internal behaviour of tcmalloc to return an allocated size of 0 when the target pointer is null (refer to TCMallocImplementation::GetAllocatedSize). This change was reviewed as https://codereview.appspot.com/5833050/.

git-svn-id: http://gperftools.googlecode.com/svn/trunk@149 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
This commit is contained in:
chappedm@gmail.com 2012-04-21 17:27:54 +00:00
parent 9be2f8d802
commit bafd0f8b7c

View File

@ -1468,6 +1468,8 @@ void* cpp_memalign(size_t align, size_t size) {
// As promised, the definition of this function, declared above.
size_t TCMallocImplementation::GetAllocatedSize(const void* ptr) {
if (ptr == NULL)
return 0;
ASSERT(TCMallocImplementation::GetOwnership(ptr)
!= TCMallocImplementation::kNotOwned);
return GetSizeWithCallback(ptr, &InvalidGetAllocatedSize);