]> granicus.if.org Git - apache/commitdiff
avoid a palloc of zero bytes so memory debuggers don't barf
authorJeff Trawick <trawick@apache.org>
Sat, 26 Jan 2002 23:05:10 +0000 (23:05 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 26 Jan 2002 23:05:10 +0000 (23:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93038 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index 013b5344e82bba9ec351b7640487dffeae942a8c..e265bb84722f386563beed532d0dec9eaa9f96e3 100644 (file)
@@ -483,6 +483,15 @@ void ap_core_reorder_directories(apr_pool_t *p, server_rec *s)
     nelts = sec_dir->nelts;
     elts = (ap_conf_vector_t **)sec_dir->elts;
 
+    if (!nelts) {
+        /* simple case of already being sorted... */
+        /* We're not checking this condition to be fast... we're checking
+         * it to avoid trying to palloc zero bytes, which can trigger some
+         * memory debuggers to barf
+         */
+        return;
+    }
+    
     /* we have to allocate tmp space to do a stable sort */
     apr_pool_create(&tmp, p);
     sortbin = apr_palloc(tmp, sec_dir->nelts * sizeof(*sortbin));