Commit a1b53a94 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#4112 avoid jemalloc's usable size problem with a NULL pointer refs[t:4112]

git-svn-id: file:///svn/toku/tokudb@36778 c7de825b-a66e-492c-adef-691d508d4ae1
parent b7e4fa50
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include <toku_portability.h> #include <toku_portability.h>
#include "memory.h" #include "memory.h"
...@@ -19,8 +19,8 @@ static realloc_fun_t t_xrealloc = 0; ...@@ -19,8 +19,8 @@ static realloc_fun_t t_xrealloc = 0;
static MEMORY_STATUS_S status; static MEMORY_STATUS_S status;
static size_t static size_t
my_malloc_usable_size(void *p UU()) { my_malloc_usable_size(void *p) {
return malloc_usable_size(p); return p == NULL ? 0 : malloc_usable_size(p);
} }
void void
...@@ -146,7 +146,7 @@ toku_xrealloc(void *v, size_t size) { ...@@ -146,7 +146,7 @@ toku_xrealloc(void *v, size_t size) {
size_t size_t
toku_malloc_usable_size(void *p) { toku_malloc_usable_size(void *p) {
return malloc_usable_size(p); return p == NULL ? 0 : malloc_usable_size(p);
} }
void * void *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment