PATCH: Mempools segv on shutdown

From: Robert Collins <robert.collins@dont-contact.us>
Date: Wed, 25 Apr 2001 12:56:19 +1000

This fixes a segv on shutdown IIF memPoolDestroy is called from any
external module. We should shuffle the stack down, but that's a
different issue.

Rob

Index: MemPool.c
===================================================================
RCS file: /cvsroot/squid/squid/src/MemPool.c,v
retrieving revision 1.5
diff -u -p -r1.5 MemPool.c
--- MemPool.c 2001/01/12 08:20:32 1.5
+++ MemPool.c 2001/04/25 02:53:59
@@ -118,13 +118,14 @@ memCleanModule(void)
     int dirty_count = 0;
     for (i = 0; i < Pools.count; i++) {
  MemPool *pool = Pools.items[i];
- if (memPoolInUseCount(pool)) {
- memPoolDescribe(pool);
- dirty_count++;
- } else {
- memPoolDestroy(pool);
- Pools.items[i] = NULL;
- }
+ if (pool)
+ if (memPoolInUseCount(pool)) {
+ memPoolDescribe(pool);
+ dirty_count++;
+ } else {
+ memPoolDestroy(pool);
+ Pools.items[i] = NULL;
+ }
     }
     if (dirty_count)
  debug(63, 2) ("memCleanModule: %d pools are left dirty\n",
dirty_count);
@@ -221,9 +222,13 @@ memPoolCreate(const char *label, size_t
 void
 memPoolDestroy(MemPool * pool)
 {
+ int i;
     assert(pool);
     stackClean(&pool->pstack);
     xfree(pool);
+ for (i = 0; i < Pools.count; i++)
+ if (Pools.items[i]==pool)
+ Pools.items[i]=NULL;
 }

 void *
Received on Tue Apr 24 2001 - 20:55:39 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:48 MST