You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2010/09/27 16:32:34 UTC
svn commit: r1001755 - /httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c
Author: sf
Date: Mon Sep 27 14:32:33 2010
New Revision: 1001755
URL: http://svn.apache.org/viewvc?rev=1001755&view=rev
Log:
Avoid potential segfault (found by clang/scan-build).
This is r791409 from mod_slotmem_shm.c applied to mod_slotmem_plain.c
Modified:
httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c
Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c?rev=1001755&r1=1001754&r2=1001755&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c (original)
+++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_plain.c Mon Sep 27 14:32:33 2010
@@ -78,13 +78,18 @@ static apr_status_t slotmem_create(ap_sl
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