Commit 2e5c83e8 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

realloc must also be poisoned. Addresses #1032, #1343, #1328.

git-svn-id: file:///svn/toku/tokudb.1032b+1343@8457 c7de825b-a66e-492c-adef-691d508d4ae1
parent 42e3dc99
......@@ -86,6 +86,7 @@ char* strdup(const char *) __attribute__((__deprecated__));
char* __strdup(const char *) __attribute__((__deprecated__));
void *malloc(size_t) __attribute__((__deprecated__));
void free(void*) __attribute__((__deprecated__));
void *realloc(void*, size_t) __attribute__((__deprecated__));
# endif
#endif
......
......@@ -24,6 +24,7 @@
toku_os_initialize_settings;
toku_os_is_absolute_name;
toku_os_mkdir;
toku_realloc;
toku_strdup;
local: *;
......
......@@ -172,7 +172,7 @@ static void dbg_name_insert (unsigned char *name) {
if (names==0) {
names=malloc(sizeof(*names));
} else {
names = realloc(names, n_names*sizeof(*names));
names = toku_realloc(names, n_names*sizeof(*names));
}
names[n_names-1]=name;
}
......@@ -460,7 +460,7 @@ step_name (void) {
assert(cursor_count_n_items==calc_n_items);
r = name_cursor->c_get(name_cursor, &nc_key, &nc_data, DB_FIRST);
if (r==DB_NOTFOUND) {
nc_key.data = realloc(nc_key.data, 1);
nc_key.data = toku_realloc(nc_key.data, 1);
((char*)nc_key.data)[0]=0;
cursor_count_n_items=0;
} else {
......
......@@ -441,7 +441,7 @@ step_name (void) {
assert(cursor_count_n_items==calc_n_items);
r = name_cursor->c_get(name_cursor, &nc_key, &nc_data, DB_FIRST);
if (r==DB_NOTFOUND) {
nc_key.data = realloc(nc_key.data, 1);
nc_key.data = toku_realloc(nc_key.data, 1);
((char*)nc_key.data)[0]=0;
cursor_count_n_items=0;
} else {
......
......@@ -263,7 +263,7 @@ static void step_name (void) {
assert(cursor_count_n_items==calc_n_items);
r = name_cursor->c_get(name_cursor, &nc_key, &nc_data, DB_FIRST);
if (r==DB_NOTFOUND) {
nc_key.data = realloc(nc_key.data, 1);
nc_key.data = toku_realloc(nc_key.data, 1);
((char*)nc_key.data)[0]=0;
cursor_count_n_items=0;
} else {
......
......@@ -35,7 +35,7 @@ static void* my_malloc(size_t size) {
static __attribute__((__unused__))
void*
my_realloc (void *p, size_t size) {
return realloc(p, size);
return toku_realloc(p, size);
}
static __attribute__((__unused__))
......
......@@ -38,7 +38,7 @@ my_malloc (size_t size) {
static __attribute__((__unused__))
void*
my_realloc (void *p, size_t size) {
void* newp = realloc(p, size);
void* newp = toku_realloc(p, size);
// if (verbose) printf("realloc [%d] %p.\n", (int)size, newp);
return newp;
}
......
......@@ -45,11 +45,11 @@ test_key_size_limit (int dup_mode) {
assert(lo <= mi && mi <= hi);
u_int32_t ks = mi;
if (verbose > 1) printf("trying %u %u %u ks=%u\n", lo, mi, hi, ks);
k = realloc(k, ks); assert(k);
k = toku_realloc(k, ks); assert(k);
memset(k, 0, ks);
memcpy(k, &ks, sizeof ks);
u_int32_t vs = sizeof (u_int32_t);
v = realloc(v, vs); assert(v);
v = toku_realloc(v, vs); assert(v);
memset(v, 0, vs);
memcpy(v, &vs, sizeof vs);
DBT key, val;
......@@ -101,11 +101,11 @@ test_data_size_limit (int dup_mode) {
assert(lo <= mi && mi <= hi);
u_int32_t ks = sizeof (u_int32_t);
if (verbose > 1) printf("trying %u %u %u ks=%u\n", lo, mi, hi, ks);
k = realloc(k, ks); assert(k);
k = toku_realloc(k, ks); assert(k);
memset(k, 0, ks);
memcpy(k, &ks, sizeof ks);
u_int32_t vs = mi;
v = realloc(v, vs); assert(v);
v = toku_realloc(v, vs); assert(v);
memset(v, 0, vs);
memcpy(v, &vs, sizeof vs);
DBT key, val;
......
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