diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/smb_macros.h | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 6 | ||||
-rw-r--r-- | source3/lib/util_str.c | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 6c9ab017ba..3ae8814cfd 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -274,7 +274,7 @@ copy an IP address from one buffer to another #define SMB_REALLOC(p,s) Realloc((p),(s),True) /* Always frees p on error or s == 0 */ #define SMB_REALLOC_KEEP_OLD_ON_ERROR(p,s) Realloc((p),(s),False) /* Never frees p on error or s == 0 */ #define SMB_REALLOC_ARRAY(p,type,count) (type *)realloc_array((p),sizeof(type),(count),True) /* Always frees p on error or s == 0 */ -#define SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(p,type,count) (type *)realloc_array((p),sizeof(type),(count),False) /* Always frees p on error or s == 0 */ +#define SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(p,type,count) (type *)realloc_array((p),sizeof(type),(count),False) /* Never frees p on error or s == 0 */ #define SMB_CALLOC_ARRAY(type,count) (type *)calloc_array(sizeof(type),(count)) #define SMB_XMALLOC_P(type) (type *)smb_xmalloc_array(sizeof(type),1) #define SMB_XMALLOC_ARRAY(type,count) (type *)smb_xmalloc_array(sizeof(type),(count)) diff --git a/source3/lib/util.c b/source3/lib/util.c index 758ebfd27d..6e0a7c0e2f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1009,15 +1009,15 @@ void *Realloc(void *p, size_t size, BOOL free_old_on_error) Type-safe realloc. ****************************************************************************/ -void *realloc_array(void *p, size_t el_size, unsigned int count, BOOL keep_old_on_error) +void *realloc_array(void *p, size_t el_size, unsigned int count, BOOL free_old_on_error) { if (count >= MAX_ALLOC_SIZE/el_size) { - if (!keep_old_on_error) { + if (free_old_on_error) { SAFE_FREE(p); } return NULL; } - return Realloc(p, el_size*count, keep_old_on_error); + return Realloc(p, el_size*count, free_old_on_error); } /**************************************************************************** diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index f1ae9a472a..446a4a00a1 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1779,8 +1779,9 @@ BOOL str_list_copy(char ***dest, const char **src) DEBUG(0,("str_list_copy: Unable to re-allocate memory")); str_list_free(&list); return False; - } else + } else { list = rlist; + } memset (&list[num], 0, ((sizeof(char **)) * (S_LIST_ABS +1))); } |