From a7cdf35b6016c7eb1b4ba836d57208dcde0d6180 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 14 Feb 2020 18:39:15 +0400 Subject: [PATCH] [apr-util] Fix issues reported by scan-build. --- libs/apr-util/hooks/apr_hooks.c | 4 +++- libs/apr-util/misc/apr_queue.c | 4 ++-- libs/apr-util/xml/apr_xml.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/apr-util/hooks/apr_hooks.c b/libs/apr-util/hooks/apr_hooks.c index da0ae97058..776bc884e7 100644 --- a/libs/apr-util/hooks/apr_hooks.c +++ b/libs/apr-util/hooks/apr_hooks.c @@ -180,7 +180,9 @@ static TSort *tsort(TSort *pData,int nItems) break; } } - pTail->pNext=NULL; /* unfudge the tail */ + if (pTail) { + pTail->pNext = NULL; /* unfudge the tail */ + } return pHead; } diff --git a/libs/apr-util/misc/apr_queue.c b/libs/apr-util/misc/apr_queue.c index e905a53ebb..a947df8a08 100644 --- a/libs/apr-util/misc/apr_queue.c +++ b/libs/apr-util/misc/apr_queue.c @@ -222,7 +222,7 @@ APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data) } if (apr_queue_full(queue)) { - rv = apr_thread_mutex_unlock(queue->one_big_mutex); + apr_thread_mutex_unlock(queue->one_big_mutex); return APR_EAGAIN; } @@ -397,7 +397,7 @@ APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data) } if (apr_queue_empty(queue)) { - rv = apr_thread_mutex_unlock(queue->one_big_mutex); + apr_thread_mutex_unlock(queue->one_big_mutex); return APR_EAGAIN; } diff --git a/libs/apr-util/xml/apr_xml.c b/libs/apr-util/xml/apr_xml.c index 73543555ff..a05348d60f 100644 --- a/libs/apr-util/xml/apr_xml.c +++ b/libs/apr-util/xml/apr_xml.c @@ -82,7 +82,7 @@ static int find_prefix(apr_xml_parser *parser, const char *prefix) ** prefix. */ for (; elem; elem = elem->parent) { - apr_xml_ns_scope *ns_scope = elem->ns_scope; + apr_xml_ns_scope *ns_scope; for (ns_scope = elem->ns_scope; ns_scope; ns_scope = ns_scope->next) { if (strcmp(prefix, ns_scope->prefix) == 0) {