builtin: use malloc, instead of calloc in array.ensure_cap/1

pull/13779/head
Delyan Angelov 2022-03-20 15:02:15 +02:00
parent 0a78847782
commit 71edaa071a
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 1 additions and 1 deletions

View File

@ -124,7 +124,7 @@ fn (mut a array) ensure_cap(required int) {
cap *= 2
}
new_size := cap * a.element_size
new_data := vcalloc(new_size)
new_data := unsafe { malloc(new_size) }
if a.data != voidptr(0) {
unsafe { vmemcpy(new_data, a.data, a.len * a.element_size) }
// TODO: the old data may be leaked when no GC is used (ref-counting?)