Blame SOURCES/0054-Ticket-49532-coverity-issues-fix-compiler-warnings-c.patch

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