diff options
| author | Elliott Hughes <enh@google.com> | 2012-10-12 17:09:02 -0700 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-10-12 17:09:03 -0700 |
| commit | fcf901d5c0924a71a1405a2535051663281da048 (patch) | |
| tree | 3f11f7205b678be632e15f013ef0443cf706bab3 | |
| parent | 9434e8febc8b223db2d49e7f97140771700113b9 (diff) | |
| parent | e7e274b13a44a63023f22630ac282ee2e919ffb7 (diff) | |
| download | bionic-fcf901d5c0924a71a1405a2535051663281da048.zip bionic-fcf901d5c0924a71a1405a2535051663281da048.tar.gz bionic-fcf901d5c0924a71a1405a2535051663281da048.tar.bz2 | |
Merge "Fix realloc(3) when chk_malloc debugging is on."
| -rw-r--r-- | libc/bionic/malloc_debug_check.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libc/bionic/malloc_debug_check.cpp b/libc/bionic/malloc_debug_check.cpp index 4190a1d..5ad3486 100644 --- a/libc/bionic/malloc_debug_check.cpp +++ b/libc/bionic/malloc_debug_check.cpp @@ -406,14 +406,16 @@ extern "C" void chk_free(void *ptr) { extern "C" void *chk_realloc(void *ptr, size_t size) { // log_message("%s: %s\n", __FILE__, __FUNCTION__); + if (!ptr) { + return chk_malloc(size); + } + +#ifdef REALLOC_ZERO_BYTES_FREE if (!size) { chk_free(ptr); return NULL; } - - if (!ptr) { - return chk_malloc(size); - } +#endif hdr_t* hdr = meta(ptr); |
