diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-15 22:00:31 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-15 22:00:31 +0000 |
commit | e8b4f469621afde49a55817c3ee50f50394454a0 (patch) | |
tree | 91feb9882e2394ba8a9bf9d21fb8e49644e92bcf /third_party | |
parent | a414df575c744def0ea91e18c14cc158676b76fe (diff) | |
download | chromium_src-e8b4f469621afde49a55817c3ee50f50394454a0.zip chromium_src-e8b4f469621afde49a55817c3ee50f50394454a0.tar.gz chromium_src-e8b4f469621afde49a55817c3ee50f50394454a0.tar.bz2 |
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
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/tcmalloc/chromium/src/tcmalloc.cc | 6 |
1 files changed, 6 insertions, 0 deletions
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( |