diff options
author | Jeremy Allison <jra@samba.org> | 2004-12-07 18:25:53 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:32 -0500 |
commit | acf9d61421faa6c0055d57fdee7db300dc5431aa (patch) | |
tree | 5482afecfe9b4a68b9a1f18d541a3109f8143ab7 /source3/lib/debug.c | |
parent | 3bd3be97dc8a581c0502410453091c195e322766 (diff) | |
download | samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.gz samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.xz samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.zip |
r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
Diffstat (limited to 'source3/lib/debug.c')
-rw-r--r-- | source3/lib/debug.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 01aedb47740..b69a35ecd5c 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -192,7 +192,7 @@ static char *debug_list_class_names_and_levels(void) if (DEBUGLEVEL_CLASS == &debug_all_class_hack) return NULL; - list = calloc(debug_num_classes + 1, sizeof(char *)); + list = SMB_CALLOC_ARRAY(char *, debug_num_classes + 1); if (!list) return NULL; @@ -210,7 +210,7 @@ static char *debug_list_class_names_and_levels(void) } /* create single string list - add space for newline */ - b = buf = malloc(dim+1); + b = buf = SMB_MALLOC(dim+1); if (!buf) { err = True; goto done; @@ -292,7 +292,7 @@ int debug_add_class(const char *classname) /* Initial loading... */ new_ptr = NULL; } - new_ptr = Realloc(new_ptr, sizeof(int) * (debug_num_classes + 1)); + new_ptr = SMB_REALLOC_ARRAY(new_ptr, int, debug_num_classes + 1); if (!new_ptr) return -1; DEBUGLEVEL_CLASS = new_ptr; @@ -309,19 +309,18 @@ int debug_add_class(const char *classname) if (new_ptr == &debug_all_class_isset_hack) { new_ptr = NULL; } - new_ptr = Realloc(new_ptr, sizeof(BOOL) * (debug_num_classes + 1)); + new_ptr = SMB_REALLOC_ARRAY(new_ptr, BOOL, debug_num_classes + 1); if (!new_ptr) return -1; DEBUGLEVEL_CLASS_ISSET = new_ptr; DEBUGLEVEL_CLASS_ISSET[ndx] = False; - new_ptr = Realloc(classname_table, - sizeof(char *) * (debug_num_classes + 1)); + new_ptr = SMB_REALLOC_ARRAY(classname_table, char *, debug_num_classes + 1); if (!new_ptr) return -1; classname_table = new_ptr; - classname_table[ndx] = strdup(classname); + classname_table[ndx] = SMB_STRDUP(classname); if (! classname_table[ndx]) return -1; |