]> granicus.if.org Git - apache/commitdiff
error detection
authorJim Jagielski <jim@apache.org>
Wed, 13 May 2009 18:34:19 +0000 (18:34 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 13 May 2009 18:34:19 +0000 (18:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@774483 13f79535-47bb-0310-9956-ffa450edef68

modules/mem/mod_sharedmem.c

index ed1d704dee4c8e8ce898ef840c722861ea5f7e3e..57713e0f930da63b52d9e7b363671f1712bb85c4 100644 (file)
@@ -449,9 +449,14 @@ static apr_status_t slotmem_get(ap_slotmem_t *slot, unsigned int id, unsigned ch
 {
 
     void *ptr;
-    char *inuse = (slot->base + (slot->size * slot->num));
+    char *inuse;
     apr_status_t ret;
 
+    if (!slot) {
+        return APR_ENOSHMAVAIL;
+    }
+
+    inuse = (slot->base + (slot->size * slot->num));
     if (!inuse[id]) {
         return APR_ENOSHMAVAIL;
     }
@@ -467,9 +472,14 @@ static apr_status_t slotmem_put(ap_slotmem_t *slot, unsigned int id, unsigned ch
 {
 
     void *ptr;
-    char *inuse = (slot->base + (slot->size * slot->num));
+    char *inuse;
     apr_status_t ret;
 
+    if (!slot) {
+        return APR_ENOSHMAVAIL;
+    }
+
+    inuse = (slot->base + (slot->size * slot->num));
     if (!inuse[id]) {
         return APR_ENOSHMAVAIL;
     }
@@ -500,6 +510,7 @@ static apr_status_t slotmem_grab(ap_slotmem_t *slot, unsigned int *id)
     if (!slot) {
         return APR_ENOSHMAVAIL;
     }
+
     inuse = (slot->base + (slot->size * slot->num));
 
     SLOTMEM_LOCK(slot->smutex);
@@ -526,6 +537,7 @@ static apr_status_t slotmem_return(ap_slotmem_t *slot, unsigned int id)
     if (!slot) {
         return APR_ENOSHMAVAIL;
     }
+
     inuse = (slot->base + (slot->size * slot->num));
 
     SLOTMEM_LOCK(slot->smutex);