[svn-commits] russell: branch 1.4 r209879 - /branches/1.4/main/db1-ast/mpool/mpool.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Aug 1 06:27:32 CDT 2009


Author: russell
Date: Sat Aug  1 06:27:25 2009
New Revision: 209879

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=209879
Log:
Resolve a valgrind warning about a read from uninitialized memory.

(issue #15396)
Reported by: aragon

Modified:
    branches/1.4/main/db1-ast/mpool/mpool.c

Modified: branches/1.4/main/db1-ast/mpool/mpool.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/db1-ast/mpool/mpool.c?view=diff&rev=209879&r1=209878&r2=209879
==============================================================================
--- branches/1.4/main/db1-ast/mpool/mpool.c (original)
+++ branches/1.4/main/db1-ast/mpool/mpool.c Sat Aug  1 06:27:25 2009
@@ -31,6 +31,8 @@
  * SUCH DAMAGE.
  */
 
+#include "asterisk.h"
+
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)mpool.c	8.5 (Berkeley) 7/26/94";
 #endif /* LIBC_SCCS and not lint */
@@ -46,6 +48,8 @@
 #include <unistd.h>
 
 #include "../include/db.h"
+
+#include "asterisk/utils.h"
 
 #define	__MPOOLINTERFACE_PRIVATE
 #include <mpool.h>
@@ -380,7 +384,7 @@
 			return (bp);
 		}
 
-new:	if ((bp = (BKT *)malloc(sizeof(BKT) + mp->pagesize)) == NULL)
+new:	if ((bp = (BKT *) ast_calloc(1, sizeof(BKT) + mp->pagesize)) == NULL)
 		return (NULL);
 #ifdef STATISTICS
 	++mp->pagealloc;




More information about the svn-commits mailing list