From: Jim Jagielski Date: Wed, 9 Jan 2013 14:14:42 +0000 (+0000) Subject: Fix mistaken reset of num_free with restored shm X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=999524be0c7d35b7895123d2c7415889e928a874;p=thirdparty%2Fapache%2Fhttpd.git Fix mistaken reset of num_free with restored shm git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1430869 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/slotmem/mod_slotmem_shm.c b/modules/slotmem/mod_slotmem_shm.c index 3959e93a8e1..ec089264508 100644 --- a/modules/slotmem/mod_slotmem_shm.c +++ b/modules/slotmem/mod_slotmem_shm.c @@ -296,6 +296,7 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, { /* void *slotmem = NULL; */ int fbased = 1; + int restored = 0; char *ptr; sharedslotdesc_t desc; ap_slotmem_instance_t *res; @@ -390,6 +391,7 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, */ if (type & AP_SLOTMEM_TYPE_PERSIST) { restore_slotmem(ptr, fname, dsize, pool); + restored = 1; } } @@ -400,7 +402,9 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, res->fbased = fbased; res->shm = shm; res->num_free = (unsigned int *)ptr; - *res->num_free = item_num; + if (!restored) { + *res->num_free = item_num; + } res->persist = (void *)ptr; ptr += AP_UNSIGNEDINT_OFFSET; res->base = (void *)ptr;