From 1510e826d84ca402a00c5cab2d2e2d172b8602d2 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Thu, 14 May 2009 23:18:07 -0300 Subject: [PATCH 1/1] When doing a realloc(), take the size of the type into account --- gc/dynarray.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc/dynarray.d b/gc/dynarray.d index f0d5218..9836258 100644 --- a/gc/dynarray.d +++ b/gc/dynarray.d @@ -106,7 +106,7 @@ public: if (new_capacity == 0) new_capacity = 4; // reallocate the memory with the new_capacity - T* new_data = cast(T*) realloc(this.data, new_capacity); + T* new_data = cast(T*) realloc(this.data, new_capacity * T.sizeof); if (new_data is null) onOutOfMemoryError(); this.data = new_data; -- 2.43.0