From 753e0d77c6ebf6b97c322c3ad53c74d248d19928 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Sat, 26 Jan 2002 23:05:10 +0000 Subject: [PATCH] avoid a palloc of zero bytes so memory debuggers don't barf git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93038 13f79535-47bb-0310-9956-ffa450edef68 --- server/core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/core.c b/server/core.c index 013b5344e8..e265bb8472 100644 --- a/server/core.c +++ b/server/core.c @@ -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)); -- 2.40.0