Browse Source

cmArray.c: Fixed bug cmArrayAlloc0() where p->alloc_cnt was treated as byte count instead of element count.

master
kevin 11 years ago
parent
commit
6f04687939
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      cmArray.c

+ 2
- 2
cmArray.c View File

44
   cmAr_t* p = cmMemAllocZ(cmAr_t,1);
44
   cmAr_t* p = cmMemAllocZ(cmAr_t,1);
45
   cmErrSetup(&p->err,&ctx->rpt,"Array");
45
   cmErrSetup(&p->err,&ctx->rpt,"Array");
46
 
46
 
47
-  p->alloc_cnt    = initCnt * eleByteCnt;
47
+  p->alloc_cnt    = initCnt;
48
   p->expand_cnt   = expandCnt;
48
   p->expand_cnt   = expandCnt;
49
   p->cur_cnt      = 0;
49
   p->cur_cnt      = 0;
50
   p->ele_byte_cnt = eleByteCnt;
50
   p->ele_byte_cnt = eleByteCnt;
51
 
51
 
52
   if( p->alloc_cnt > 0 )
52
   if( p->alloc_cnt > 0 )
53
-    p->base = cmMemAllocZ(char,p->alloc_cnt);
53
+    p->base = cmMemAllocZ(char,p->alloc_cnt*eleByteCnt);
54
 
54
 
55
   hp->h = p;
55
   hp->h = p;
56
   
56
   

Loading…
Cancel
Save