| Index: third_party/tcmalloc/allocator_shim.cc
|
| ===================================================================
|
| --- third_party/tcmalloc/allocator_shim.cc (revision 25582)
|
| +++ third_party/tcmalloc/allocator_shim.cc (working copy)
|
| @@ -160,7 +160,11 @@
|
| // TCMalloc case.
|
| new_ptr = do_realloc(ptr, size);
|
| #endif
|
| - if (new_ptr)
|
| +
|
| + // Subtle warning: NULL return does not alwas indicate out-of-memory. If
|
| + // the requested new size is zero, realloc should free the ptr and return
|
| + // NULL.
|
| + if (new_ptr || !size)
|
| return new_ptr;
|
| if (!new_mode || !call_new_handler(true))
|
| break;
|
|
|