From 92f5cb4e4b43e7f958017b7dd953792cdada953d Mon Sep 17 00:00:00 2001 From: ahodgkinson Date: Thu, 13 Jul 2006 22:45:23 +0000 Subject: [PATCH] FLAIM change. Fixed memory leak and crash in checkdb utility. git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@669 0109f412-320b-0410-ab79-c3e0c5ffbbe6 --- flaim/util/checkdb.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/flaim/util/checkdb.cpp b/flaim/util/checkdb.cpp index ca67f77..04628e5 100644 --- a/flaim/util/checkdb.cpp +++ b/flaim/util/checkdb.cpp @@ -216,8 +216,8 @@ int main( int iArgC, char ** ppucArgV) { - int iResCode = 0; - F_Pool LogPool; + int iResCode = 0; + F_Pool * pLogPool = NULL; gv_bBatchMode = FALSE; gv_bShutdown = FALSE; @@ -242,9 +242,15 @@ int main( goto Exit; } - LogPool.poolInit( 1024); + if( (pLogPool = f_new F_Pool) == NULL) + { + f_conStrOut( "\nCould not allocate a pool object.\n"); + goto Exit; + } + + pLogPool->poolInit( 1024); - if( RC_BAD( LogPool.poolAlloc( MAX_LOG_BUF, (void **)&gv_pucLogBuffer))) + if( RC_BAD( pLogPool->poolAlloc( MAX_LOG_BUF, (void **)&gv_pucLogBuffer))) { f_conStrOut( "\nCould not allocat memory.\n"); goto Exit; @@ -301,6 +307,11 @@ Exit: gv_pFileSystem = NULL; } + if( pLogPool) + { + pLogPool->Release(); + } + f_conExit(); FlmShutdown();