cmArray.c: Fixed bug cmArrayAlloc0() where p->alloc_cnt was treated as byte count instead of element count.
This commit is contained in:
parent
cc644e99d0
commit
6f04687939
@ -44,13 +44,13 @@ cmArRC_t cmArrayAlloc0( cmCtx_t* ctx, cmArrayH_t* hp, unsigned eleByteCnt, u
|
|||||||
cmAr_t* p = cmMemAllocZ(cmAr_t,1);
|
cmAr_t* p = cmMemAllocZ(cmAr_t,1);
|
||||||
cmErrSetup(&p->err,&ctx->rpt,"Array");
|
cmErrSetup(&p->err,&ctx->rpt,"Array");
|
||||||
|
|
||||||
p->alloc_cnt = initCnt * eleByteCnt;
|
p->alloc_cnt = initCnt;
|
||||||
p->expand_cnt = expandCnt;
|
p->expand_cnt = expandCnt;
|
||||||
p->cur_cnt = 0;
|
p->cur_cnt = 0;
|
||||||
p->ele_byte_cnt = eleByteCnt;
|
p->ele_byte_cnt = eleByteCnt;
|
||||||
|
|
||||||
if( p->alloc_cnt > 0 )
|
if( p->alloc_cnt > 0 )
|
||||||
p->base = cmMemAllocZ(char,p->alloc_cnt);
|
p->base = cmMemAllocZ(char,p->alloc_cnt*eleByteCnt);
|
||||||
|
|
||||||
hp->h = p;
|
hp->h = p;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user