]> git.llucax.com Git - software/dgc/naive.git/commitdiff
When doing a realloc(), take the size of the type into account
authorAlberto Bertogli <albertito@blitiri.com.ar>
Fri, 15 May 2009 02:18:07 +0000 (23:18 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Sun, 17 May 2009 21:04:01 +0000 (18:04 -0300)
gc/dynarray.d

index f0d5218b7dce1c968f59af781c6c20292954aabb..9836258ccda597e323ba6b2b432268e297bd3228 100644 (file)
@@ -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;