httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1001819 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
Date Mon, 27 Sep 2010 17:10:18 GMT
Author: jim
Date: Mon Sep 27 17:10:18 2010
New Revision: 1001819

URL: http://svn.apache.org/viewvc?rev=1001819&view=rev
Log:
No leakie

Modified:
    httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c

Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1001819&r1=1001818&r2=1001819&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original)
+++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Mon Sep 27 17:10:18 2010
@@ -16,6 +16,9 @@
 
 /* Memory handler for a shared memory divided in slot.
  * This one uses shared memory.
+ *
+ * Shared memory is cleaned-up for each restart, graceful or
+ * otherwise.
  */
 
 #include  "ap_slotmem.h"
@@ -184,17 +187,20 @@ static void restore_slotmem(void *ptr, c
 static apr_status_t cleanup_slotmem(void *param)
 {
     ap_slotmem_instance_t **mem = param;
-    apr_pool_t *pool = NULL;
 
     if (*mem) {
         ap_slotmem_instance_t *next = *mem;
-        pool = next->gpool;
+        apr_pool_t *p = next->gpool;
         while (next) {
             store_slotmem(next);
             apr_shm_destroy((apr_shm_t *)next->shm);
             next = next->next;
         }
-        apr_pool_destroy(pool);
+        apr_pool_destroy(p);
+    } else {
+        /* If shared mem was never called, then just remove
+         * the global pool */
+        apr_pool_destroy(gpool);
     }
     return APR_SUCCESS;
 }
@@ -593,14 +599,17 @@ static int post_config(apr_pool_t *p, ap
     void *data;
     const char *userdata_key = "slotmem_shm_post_config";
 
+    slotmem_shm_initialize_cleanup(p);
+
+    /* keep this around for possible future usage */
     apr_pool_userdata_get(&data, userdata_key, s->process->pool);
     if (!data) {
         apr_pool_userdata_set((const void *)1, userdata_key,
                                apr_pool_cleanup_null, s->process->pool);
+        /* Do Stuff */
         return OK;
     }
 
-    slotmem_shm_initialize_cleanup(p);
     return OK;
 }
 



Mime
View raw message