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

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