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

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