From: Alberto Bertogli Date: Fri, 15 May 2009 02:18:07 +0000 (-0300) Subject: When doing a realloc(), take the size of the type into account X-Git-Tag: word-sized-cells~6 X-Git-Url: https://git.llucax.com/software/dgc/naive.git/commitdiff_plain/1510e826d84ca402a00c5cab2d2e2d172b8602d2 When doing a realloc(), take the size of the type into account --- 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;