commit 2861f1003fbb11e74c901d5bebc7f33be38b5396 Author: Nathan Froyd froydnj@mozilla.com Date: Tue Apr 15 13:11:59 2014 -0400
Bug 993546 - Refactor malloc-wrapping memory reporter implementations. r=njn, a=abillings --- extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h | 2 +- gfx/thebes/gfxAndroidPlatform.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h b/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h index 8c60074..60b7d33 100644 --- a/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h +++ b/extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h @@ -84,7 +84,7 @@ inline void* hunspell_realloc(void* ptr, size_t size) void* result = moz_realloc(ptr, size); if (result) { HunspellReportMemoryAllocation(result); - } else { + } else if (size != 0) { // realloc failed; undo the HunspellReportMemoryDeallocation from above HunspellReportMemoryAllocation(ptr); } diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp index b220085..b47e171 100644 --- a/gfx/thebes/gfxAndroidPlatform.cpp +++ b/gfx/thebes/gfxAndroidPlatform.cpp @@ -71,7 +71,7 @@ CountingRealloc(FT_Memory memory, long cur_size, long new_size, void* p) void *pnew = realloc(p, new_size); if (pnew) { sFreetypeMemoryUsed += FreetypeMallocSizeOfOnAlloc(pnew); - } else { + } else if (new_size != 0) { // realloc failed; undo the decrement from above sFreetypeMemoryUsed += FreetypeMallocSizeOfOnAlloc(p); }