Skip to content

Commit d865684

Browse files
committed
Fix use ar->capacity for ar->mem_alloc
1 parent cfb9446 commit d865684

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/cc_array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ static enum cc_stat expand_capacity(CC_Array *ar)
853853
else
854854
ar->capacity = new_capacity;
855855

856-
void **new_buff = ar->mem_alloc(new_capacity * sizeof(void*));
856+
void **new_buff = ar->mem_alloc(ar->capacity * sizeof(void*));
857857

858858
if (!new_buff)
859859
return CC_ERR_ALLOC;

src/cc_pqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static enum cc_stat expand_capacity(CC_PQueue *pq)
193193
else
194194
pq->capacity = new_capacity;
195195

196-
void **new_buff = pq->mem_alloc(new_capacity * sizeof(void*));
196+
void **new_buff = pq->mem_alloc(pq->capacity * sizeof(void*));
197197

198198
if (!new_buff)
199199
return CC_ERR_ALLOC;

src/sized/cc_array_sized.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ static enum cc_stat expand_capacity(CC_ArraySized *ar)
809809
} else {
810810
ar->capacity = new_capacity;
811811
}
812-
uint8_t *new_buff = ar->mem_alloc(new_capacity * ar->data_length);
812+
uint8_t *new_buff = ar->mem_alloc(ar->capacity * ar->data_length);
813813

814814
if (!new_buff) {
815815
return CC_ERR_ALLOC;

0 commit comments

Comments
 (0)