From: Andrey Volk Date: Mon, 19 Apr 2021 20:27:14 +0000 (+0300) Subject: [apr] scan-build: Dereference of null pointer in apr_hash_merge() X-Git-Tag: v1.10.7^2~267 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6884d6871e84d894a40490d2c23d3d0ad534e34;p=thirdparty%2Ffreeswitch.git [apr] scan-build: Dereference of null pointer in apr_hash_merge() --- 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;