]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Avoid potential segfault (found by clang/scan-build).
authorStefan Fritsch <sf@apache.org>
Mon, 27 Sep 2010 14:32:33 +0000 (14:32 +0000)
committerStefan Fritsch <sf@apache.org>
Mon, 27 Sep 2010 14:32:33 +0000 (14:32 +0000)
This is r791409 from mod_slotmem_shm.c applied to mod_slotmem_plain.c

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1001755 13f79535-47bb-0310-9956-ffa450edef68

modules/slotmem/mod_slotmem_plain.c

index ccd1676b7a84beab2f4770b3ac7ded8442e4a676..0631bd38f160d0f543c5801ff7cb1586c3b56211 100644 (file)
@@ -78,13 +78,18 @@ static apr_status_t slotmem_create(ap_slotmem_instance_t **new, const char *name
             fname = ap_server_root_relative(pool, name);
 
         /* first try to attach to existing slotmem */
-        while (next) {
-            if (strcmp(next->name, fname) == 0) {
-                /* we already have it */
-                *new = next;
-                return APR_SUCCESS;
+        if (next) {
+            for (;;) {
+                if (strcmp(next->name, fname) == 0) {
+                    /* we already have it */
+                    *new = next;
+                    return APR_SUCCESS;
+                }
+                if (!next->next) {
+                     break;
+                }
+                next = next->next;
             }
-            next = next->next;
         }
     }
     else