svn commit: samba r13974 - in trunk/source: include lib
jra at samba.org
jra at samba.org
Tue Mar 7 18:52:46 GMT 2006
Author: jra
Date: 2006-03-07 18:52:45 +0000 (Tue, 07 Mar 2006)
New Revision: 13974
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13974
Log:
Re-fix Coverity #156 - I had left the hidden arg. inconsistent
between Realloc and realloc_array.
Jeremy.
Modified:
trunk/source/include/smb_macros.h
trunk/source/lib/util.c
trunk/source/lib/util_str.c
Changeset:
Modified: trunk/source/include/smb_macros.h
===================================================================
--- trunk/source/include/smb_macros.h 2006-03-07 18:39:52 UTC (rev 13973)
+++ trunk/source/include/smb_macros.h 2006-03-07 18:52:45 UTC (rev 13974)
@@ -274,7 +274,7 @@
#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))
Modified: trunk/source/lib/util.c
===================================================================
--- trunk/source/lib/util.c 2006-03-07 18:39:52 UTC (rev 13973)
+++ trunk/source/lib/util.c 2006-03-07 18:52:45 UTC (rev 13974)
@@ -1009,15 +1009,15 @@
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);
}
/****************************************************************************
Modified: trunk/source/lib/util_str.c
===================================================================
--- trunk/source/lib/util_str.c 2006-03-07 18:39:52 UTC (rev 13973)
+++ trunk/source/lib/util_str.c 2006-03-07 18:52:45 UTC (rev 13974)
@@ -1779,8 +1779,9 @@
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)));
}
More information about the samba-cvs
mailing list