From 2d8639409b4749afd92266347f20b99da80e14c9 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Thu, 14 May 2009 23:18:09 -0300 Subject: [PATCH] Initialize capacity to 0 when allocating a new cell Otherwise, when later we do cell.capacity == 0 we're using uninitialized memory and can return the wrong result if we're not lucky enough to get 0s. --- gc/gc.d | 1 + 1 file changed, 1 insertion(+) diff --git a/gc/gc.d b/gc/gc.d index 3ee81ac..a7c8f59 100644 --- a/gc/gc.d +++ b/gc/gc.d @@ -533,6 +533,7 @@ public: // No luck still, allocate new memory cell = cast(Cell*) cstdlib.malloc(size + Cell.sizeof); + cell.capacity = 0; // so we can later tell it's new if (cell) goto success; -- 2.43.0