From cfa194289ee0c9d26d5775f0b67cf9b481bf357f Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 12 Jan 2018 10:37:18 -0500
Subject: [PATCH] Ticket 49532 - coverity issues - fix compiler warnings &
clang issues
Description: Fixed all the warnings
https://pagure.io/389-ds-base/issue/49532
Reviewed by: tbordaz(Thanks!)
(cherry picked from commit 05907ae05c8a88a64b86747879c002d55d356673)
---
ldap/servers/slapd/back-ldbm/idl_set.c | 4 ++--
ldap/servers/slapd/control.c | 2 +-
src/nunc-stans/ns/ns_thrpool.c | 7 ++++++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ldap/servers/slapd/back-ldbm/idl_set.c b/ldap/servers/slapd/back-ldbm/idl_set.c
index b68e7ab76..f9a900f1f 100644
--- a/ldap/servers/slapd/back-ldbm/idl_set.c
+++ b/ldap/servers/slapd/back-ldbm/idl_set.c
@@ -270,7 +270,7 @@ idl_set_union(IDListSet *idl_set, backend *be)
* Allocate a new set based on the size of our sets.
*/
IDList *result_list = idl_alloc(idl_set->total_size);
- IDList *idl = idl_set->head;
+ IDList *idl = NULL;
IDList *idl_del = NULL;
IDList *prev_idl = NULL;
NIDS last_min = 0;
@@ -398,7 +398,7 @@ idl_set_intersect(IDListSet *idl_set, backend *be)
* we don't care if we have allids here, because we'll ignore it anyway.
*/
result_list = idl_alloc(idl_set->minimum->b_nids);
- IDList *idl = idl_set->head;
+ IDList *idl = NULL;
/* The previous value we inserted. */
NIDS last_min = 0;
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
index 91d8abb95..366ec7897 100644
--- a/ldap/servers/slapd/control.c
+++ b/ldap/servers/slapd/control.c
@@ -337,7 +337,7 @@ get_ldapmessage_controls_ext(
slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &ctrl_not_found);
slapi_pblock_set(pb, SLAPI_PWPOLICY, &ctrl_not_found);
slapi_log_err(SLAPI_LOG_CONNS, "get_ldapmessage_controls_ext", "Warning: conn=%" PRIu64 " op=%d contains an empty list of controls\n",
- pb_conn->c_connid, pb_op->o_opid);
+ pb_conn ? pb_conn->c_connid : -1, pb_op ? pb_op->o_opid : -1);
} else {
/* len, ber_len_t is uint, not int, cannot be != -1, may be better to remove this check. */
if ((tag != LBER_END_OF_SEQORSET) && (len != -1)) {
diff --git a/src/nunc-stans/ns/ns_thrpool.c b/src/nunc-stans/ns/ns_thrpool.c
index 1d8bb03f1..d95b0c38b 100644
--- a/src/nunc-stans/ns/ns_thrpool.c
+++ b/src/nunc-stans/ns/ns_thrpool.c
@@ -1587,7 +1587,12 @@ ns_thrpool_shutdown(struct ns_thrpool_t *tp)
*/
for (size_t i = 0; i < tp->thread_count; i++) {
ns_result_t result = ns_add_shutdown_job(tp);
- PR_ASSERT(result == NS_SUCCESS);
+ if (result != NS_SUCCESS) {
+#ifdef DEBUG
+ ns_log(LOG_DEBUG, "ns_thrpool_shutdown - Failed to add shutdown job: error (%d)\n", result);
+#endif
+ PR_ASSERT(0);
+ }
}
/* Make sure all threads are woken up to their shutdown jobs. */
pthread_mutex_lock(&(tp->work_q_lock));
--
2.13.6