From 71edaa071a706d26268b8ad63b9db36e80377f61 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 20 Mar 2022 15:02:15 +0200 Subject: [PATCH] builtin: use malloc, instead of calloc in array.ensure_cap/1 --- vlib/builtin/array.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index 74f942cfc0..6109d66178 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -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?)