From: Jeff Trawick Date: Sat, 26 Jan 2002 23:05:10 +0000 (+0000) Subject: avoid a palloc of zero bytes so memory debuggers don't barf X-Git-Tag: 2.0.31~81 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=753e0d77c6ebf6b97c322c3ad53c74d248d19928;p=apache 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 --- 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));