]> granicus.if.org Git - apache/commitdiff
Calculate the power of two size of the buffer before allocating it.
authorPaul Querna <pquerna@apache.org>
Tue, 15 Nov 2011 17:47:33 +0000 (17:47 +0000)
committerPaul Querna <pquerna@apache.org>
Tue, 15 Nov 2011 17:47:33 +0000 (17:47 +0000)
Spotted by: Rüdiger Plüm

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1202329 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/event/equeue.c

index 0d77b40eb8a138c8d75be4977ffafd8004e53d3d..4750ab1c537198fe9fcf670f71b59b7aa5b3da40 100644 (file)
@@ -77,8 +77,8 @@ ap_equeue_create(apr_pool_t *p, apr_uint32_t nelem, apr_size_t elem_size, ap_equ
     *eqout = NULL;
 
     eq = apr_palloc(p, sizeof(ap_equeue_t));
-    eq->bytes = apr_palloc(p, (1 + nelem) * elem_size);
     eq->nelem = nearest_power(nelem);
+    eq->bytes = apr_palloc(p, eq->nelem * elem_size);
     eq->elem_size = elem_size;
     eq->writeCount = 0;
     eq->readCount = 0;