]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[apr] scan-build: Dereference of null pointer in apr_hash_merge()
authorAndrey Volk <andywolk@gmail.com>
Mon, 19 Apr 2021 20:27:14 +0000 (23:27 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 19 Oct 2021 17:10:35 +0000 (20:10 +0300)
libs/apr/tables/apr_hash.c

index 5cac297af96723b1689c50f3ba67acadb2663433..0e707601f513bce715cf1ba42a3977872f035eb1 100644 (file)
@@ -28,6 +28,8 @@
 #include <string.h>
 #endif
 
+#include <assert.h>     /* assert() */
+
 #if APR_POOL_DEBUG && APR_HAVE_STDIO_H
 #include <stdio.h>
 #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;