From 6f0468793913c43f8b43314500b81342e507942a Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 21 Mar 2013 11:34:58 -0700 Subject: [PATCH] cmArray.c: Fixed bug cmArrayAlloc0() where p->alloc_cnt was treated as byte count instead of element count. --- cmArray.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmArray.c b/cmArray.c index 32ff6b5..08211e0 100644 --- a/cmArray.c +++ b/cmArray.c @@ -44,13 +44,13 @@ cmArRC_t cmArrayAlloc0( cmCtx_t* ctx, cmArrayH_t* hp, unsigned eleByteCnt, u cmAr_t* p = cmMemAllocZ(cmAr_t,1); cmErrSetup(&p->err,&ctx->rpt,"Array"); - p->alloc_cnt = initCnt * eleByteCnt; + p->alloc_cnt = initCnt; p->expand_cnt = expandCnt; p->cur_cnt = 0; p->ele_byte_cnt = eleByteCnt; if( p->alloc_cnt > 0 ) - p->base = cmMemAllocZ(char,p->alloc_cnt); + p->base = cmMemAllocZ(char,p->alloc_cnt*eleByteCnt); hp->h = p;