Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2033)

Unified Diff: third_party/tcmalloc/allocator_shim.cc

Issue 194040: Fix realloc to not call the new_handler (which is for failures)... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698