From 9434f0c2a0e46c580a2aacc04cc1b58876bd3bd8 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Thu, 6 Jan 2011 16:48:00 -0700
Subject: [PATCH] fix an exit crash.

---
 indra/llcommon/llmemory.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp
index f1285841b3f..1f40f5e17af 100644
--- a/indra/llcommon/llmemory.cpp
+++ b/indra/llcommon/llmemory.cpp
@@ -1248,13 +1248,18 @@ S32  LLPrivateMemoryPool::getChunkIndex(U32 size)
 void  LLPrivateMemoryPool::destroyPool()
 {
 	lock() ;
-	for(U32 i = 0 ; i < mHashFactor; i++)
+	if(mNumOfChunks > 0)
 	{
-		while(mChunkHashList[i])
+		for(U32 i = 0 ; i < mHashFactor; i++)
 		{
-			removeChunk(mChunkHashList[i]) ;
+			while(mChunkHashList[i])
+			{
+				removeChunk(mChunkHashList[i]) ;
+			}
 		}
 	}
+	mChunkHashList.clear() ;
+	mHashFactor = 1 ;
 	llassert_always(mNumOfChunks == 0) ;
 	llassert_always(mReservedPoolSize == 0) ;
 
-- 
GitLab