Permalink
Browse files

return zero for NotOwned memory size.

Instead of checking with ASSERT, just return zero if the incoming
memory is not owned by tcmalloc.
  • Loading branch information...
1 parent 5945b2f commit 8f60ba949fb8576c530ef4be148bff97106ddc59 @bcui6611 bcui6611 committed Apr 12, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/tcmalloc.cc
View
5 src/tcmalloc.cc
@@ -1447,8 +1447,9 @@ 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) {
- ASSERT(TCMallocImplementation::GetOwnership(ptr)
- != TCMallocImplementation::kNotOwned);
+ if (TCMallocImplementation::GetOwnership(ptr)
+ == TCMallocImplementation::kNotOwned)
+ return 0;
return GetSizeWithCallback(ptr, &InvalidGetAllocatedSize);
}

0 comments on commit 8f60ba9

Please sign in to comment.