From 40ec5a4e522450458fac6f4c5c9011623b9fa328 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 19 Sep 2013 08:28:26 +1000 Subject: [PATCH] Fix bug where freed memory is written to. --- src/gwin/gwin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 998fb8d3..44d4143c 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -172,10 +172,11 @@ void gwinDestroy(GHandle gh) { gh->vmt->Destroy(gh); // Clean up the structure - if (gh->flags & GWIN_FLG_DYNAMIC) + if (gh->flags & GWIN_FLG_DYNAMIC) { + gh->flags = 0; // To be sure, to be sure gfxFree((void *)gh); - - gh->flags = 0; // To be sure, to be sure + } else + gh->flags = 0; // To be sure, to be sure } const char *gwinGetClassName(GHandle gh) {