From: Chris Porter Date: Fri, 29 Feb 2008 21:04:49 +0000 (+0000) Subject: Add malloc checking to lua/nterfacer/trojanscan. X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/f8d5cfcf45e5ae05ebe3ca8ac759fd2465faded7 Add malloc checking to lua/nterfacer/trojanscan. Cosmetic alteration to nsmalloc output. --- diff --git a/core/nsmalloc.c b/core/nsmalloc.c index e4b03334..3c23f03b 100644 --- a/core/nsmalloc.c +++ b/core/nsmalloc.c @@ -129,15 +129,21 @@ void nsfreeall(unsigned int poolid) { pools[poolid].count=0; } +void nscheckfreeall(unsigned int poolid) { + if (poolid >= MAXPOOL) + return; + + if (pools[poolid].first.next) { + Error("core",ERR_INFO,"nsmalloc: Blocks still allocated in pool #%d (%s): %lub, %lu items",poolid,poolnames[poolid]?poolnames[poolid]:"??",pools[poolid].size,pools[poolid].count); + nsfreeall(poolid); + } +} + void nsexit() { unsigned int i; - for (i=0;i