From e8b4f469621afde49a55817c3ee50f50394454a0 Mon Sep 17 00:00:00 2001 From: "piman@chromium.org" Date: Thu, 15 Mar 2012 22:00:31 +0000 Subject: tcmalloc: make tc_malloc_size(NULL) return 0 instead of asserting Although unspecified, this is consistent with GLIBC's implementation that third-party code is relying on. BUG=118087 TEST=run all tests, run aura chrome --ui-use-gpu-process with NVIDIA driver, observe no assert. Review URL: https://chromiumcodereview.appspot.com/9701053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127006 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/tcmalloc/chromium/src/tcmalloc.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'third_party') diff --git a/third_party/tcmalloc/chromium/src/tcmalloc.cc b/third_party/tcmalloc/chromium/src/tcmalloc.cc index d7084c9..a87a4df 100644 --- a/third_party/tcmalloc/chromium/src/tcmalloc.cc +++ b/third_party/tcmalloc/chromium/src/tcmalloc.cc @@ -1487,6 +1487,12 @@ 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) { + // Chromium workaround for third-party code calling tc_malloc_size(NULL), see + // http://code.google.com/p/chromium/issues/detail?id=118087 + // Note: this is consistent with GLIBC's implementation of + // malloc_usable_size(NULL). + if (ptr == NULL) + return 0; ASSERT(TCMallocImplementation::GetOwnership(ptr) != TCMallocImplementation::kNotOwned); return ExcludeSpaceForMark( -- cgit v1.1