From 68f7d87cf5eae6f656e43bb8472b555755a9cef4 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Mon, 18 Jul 2011 23:02:25 -0300 Subject: [PATCH] Don't leak weak pointers The free() call after the return is never executed, so we have to move it inside the locked() block of code. --- rt/gc/cdgc/gc.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rt/gc/cdgc/gc.d b/rt/gc/cdgc/gc.d index e6b3c11..98e5899 100644 --- a/rt/gc/cdgc/gc.d +++ b/rt/gc/cdgc/gc.d @@ -1981,8 +1981,8 @@ void weakpointerDestroy( void* p ) return locked!(void, () { if (wp.reference) rt_detachDisposeEvent(wp.reference, &wp.ondestroy); + cstdlib.free(wp); })(); - cstdlib.free(wp); } } -- 2.43.0