From d6884d6871e84d894a40490d2c23d3d0ad534e34 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 19 Apr 2021 23:27:14 +0300 Subject: [PATCH] [apr] scan-build: Dereference of null pointer in apr_hash_merge() --- libs/apr/tables/apr_hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/apr/tables/apr_hash.c b/libs/apr/tables/apr_hash.c index 5cac297af9..0e707601f5 100644 --- a/libs/apr/tables/apr_hash.c +++ b/libs/apr/tables/apr_hash.c @@ -28,6 +28,8 @@ #include #endif +#include /* assert() */ + #if APR_POOL_DEBUG && APR_HAVE_STDIO_H #include #endif @@ -433,6 +435,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, for (k = 0; k <= base->max; k++) { for (iter = base->array[k]; iter; iter = iter->next) { i = iter->hash & res->max; + assert(new_vals); new_vals[j].klen = iter->klen; new_vals[j].key = iter->key; new_vals[j].val = iter->val;