From: Stefan Fritsch Date: Mon, 27 Sep 2010 14:32:33 +0000 (+0000) Subject: Avoid potential segfault (found by clang/scan-build). X-Git-Tag: 2.3.9~414 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a1f497d6f89ebdaec120e9e347f9c5407e275043;p=thirdparty%2Fapache%2Fhttpd.git Avoid potential segfault (found by clang/scan-build). 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 --- diff --git a/modules/slotmem/mod_slotmem_plain.c b/modules/slotmem/mod_slotmem_plain.c index ccd1676b7a8..0631bd38f16 100644 --- a/modules/slotmem/mod_slotmem_plain.c +++ b/modules/slotmem/mod_slotmem_plain.c @@ -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