From: Russell Bryant Date: Sat, 1 Aug 2009 11:27:25 +0000 (+0000) Subject: Resolve a valgrind warning about a read from uninitialized memory. X-Git-Tag: 1.4.26.2~4^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffe395f4101a199386b9dfde2bea40d03476890b;p=thirdparty%2Fasterisk.git Resolve a valgrind warning about a read from uninitialized memory. (issue #15396) Reported by: aragon git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@209879 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/db1-ast/mpool/mpool.c b/main/db1-ast/mpool/mpool.c index b5b7c86d65..719136d7b2 100644 --- a/main/db1-ast/mpool/mpool.c +++ b/main/db1-ast/mpool/mpool.c @@ -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 */ @@ -47,6 +49,8 @@ static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94"; #include "../include/db.h" +#include "asterisk/utils.h" + #define __MPOOLINTERFACE_PRIVATE #include @@ -380,7 +384,7 @@ mpool_bkt(mp) 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;