From d0c6093ae4cc8c229890d097c80c21c73553b971 Mon Sep 17 00:00:00 2001 From: Mark Olsen Date: Mon, 16 Jul 2007 17:14:39 +0000 Subject: [PATCH] Fixed a memory leak the size of Russia. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2520 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/qclib/initlib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index d169ea2a8..c97e44236 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -71,10 +71,10 @@ void PRAddressableFlush(progfuncs_t *progfuncs, int totalammount) if (addressablehunk) #ifdef _WIN32 - VirtualFree(addressablehunk, 0, MEM_RELEASE); //doesn't this look complicated? :p + VirtualFree(addressablehunk, 0, MEM_RELEASE); //doesn't this look complicated? :p addressablehunk = VirtualAlloc (NULL, totalammount, MEM_RESERVE, PAGE_NOACCESS); #else - free(addressablehunk); + free(addressablehunk); addressablehunk = malloc(totalammount); //linux will allocate-on-use anyway, which is handy. // memset(addressablehunk, 0xff, totalammount); #endif @@ -628,6 +628,12 @@ void CloseProgs(progfuncs_t *inst) PRHunkFree(inst, 0); +#ifdef _WIN32 + VirtualFree(addressablehunk, 0, MEM_RELEASE); //doesn't this look complicated? :p +#else + free(inst->addressablehunk); +#endif + /* while(inst->prinst->extensionbuiltin) {