From e39eb286293d273d59449b32061fe7a1bc705d2c Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 20 Feb 2020 23:20:53 +0400 Subject: [PATCH] [apr] scan-build: fix dereference of null pointer in apr_hash_merge() and apr_proc_other_child_unregister() --- libs/apr/misc/unix/otherchild.c | 2 +- libs/apr/tables/apr_hash.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/apr/misc/unix/otherchild.c b/libs/apr/misc/unix/otherchild.c index 427a57e7e4..c97cfdd644 100644 --- a/libs/apr/misc/unix/otherchild.c +++ b/libs/apr/misc/unix/otherchild.c @@ -96,7 +96,7 @@ APR_DECLARE(void) apr_proc_other_child_unregister(void *data) } /* segfault if this function called with invalid parm */ - apr_pool_cleanup_kill(cur->p, cur->data, other_child_cleanup); + if (cur) apr_pool_cleanup_kill(cur->p, cur->data, other_child_cleanup); other_child_cleanup(data); } diff --git a/libs/apr/tables/apr_hash.c b/libs/apr/tables/apr_hash.c index 4e3723e19f..5cac297af9 100644 --- a/libs/apr/tables/apr_hash.c +++ b/libs/apr/tables/apr_hash.c @@ -459,7 +459,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, break; } } - if (!ent) { + if (new_vals && !ent) { new_vals[j].klen = iter->klen; new_vals[j].key = iter->key; new_vals[j].val = iter->val;