andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0001-Ticket-48203-Fix-coverity-issues-06-22-2015.patch

a2f18f
From 97da9cb32b41d87d9dc5930a2ad931df559ae7f5 Mon Sep 17 00:00:00 2001
a2f18f
From: Noriko Hosoi <nhosoi@redhat.com>
a2f18f
Date: Tue, 23 Jun 2015 14:48:13 -0700
a2f18f
Subject: [PATCH 1/2] Ticket #48203 - Fix coverity issues - 06/22/2015
a2f18f
a2f18f
Description:
a2f18f
13294       Uninitialized scalar variable -- retrocl_init_trimming (introduced by #47669)
a2f18f
13293       Resource leak -- retrocl_init_trimming (introduced by #47669)
a2f18f
a2f18f
2. Defect type: CHECKED_RETURN
a2f18f
50. ldap/servers/slapd/tools/ldclt/ldapfct.c:1945:
a2f18f
9.  ldap/servers/slapd/tools/ldclt/ldapfct.c:952:
a2f18f
    check_return: Calling "addErrorStat" without checking return value
a2f18f
    (as is done elsewhere 26 out of 28 times).
a2f18f
a2f18f
1. Defect type: COMPILER_WARNING
a2f18f
2.  ldap/servers/slapd/daemon.c:1412:21:
a2f18f
    warning: 'tp' may be used uninitialized in this function [-Wmaybe-uninitialized]
a2f18f
a2f18f
https://fedorahosted.org/389/ticket/48203
a2f18f
a2f18f
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
a2f18f
a2f18f
(cherry picked from commit 32d45c74231545ad91934147962bfb676dcdd391)
a2f18f
---
a2f18f
 ldap/servers/plugins/retrocl/retrocl_trim.c | 3 ++-
a2f18f
 ldap/servers/slapd/daemon.c                 | 2 +-
a2f18f
 ldap/servers/slapd/tools/ldclt/ldapfct.c    | 4 ++--
a2f18f
 3 files changed, 5 insertions(+), 4 deletions(-)
a2f18f
a2f18f
diff --git a/ldap/servers/plugins/retrocl/retrocl_trim.c b/ldap/servers/plugins/retrocl/retrocl_trim.c
a2f18f
index 65f3015..b09f669 100644
a2f18f
--- a/ldap/servers/plugins/retrocl/retrocl_trim.c
a2f18f
+++ b/ldap/servers/plugins/retrocl/retrocl_trim.c
a2f18f
@@ -412,7 +412,7 @@ void retrocl_housekeeping ( time_t cur_time, void *noarg )
a2f18f
 void retrocl_init_trimming (void)
a2f18f
 {
a2f18f
     const char *cl_maxage;
a2f18f
-    time_t ageval;
a2f18f
+    time_t ageval = 0; /* Don't trim, by default */
a2f18f
     const char *cl_trim_interval;
a2f18f
     
a2f18f
     cl_maxage = retrocl_get_config_str(CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE);
a2f18f
@@ -425,6 +425,7 @@ void retrocl_init_trimming (void)
a2f18f
                         "retrocl_init_trimming: ignoring invalid %s value %s; "
a2f18f
                         "not trimming retro changelog.\n",
a2f18f
                         CONFIG_CHANGELOG_MAXAGE_ATTRIBUTE, cl_maxage);
a2f18f
+            slapi_ch_free_string((char **)&cl_maxage);
a2f18f
             return;
a2f18f
         }
a2f18f
     }
a2f18f
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
a2f18f
index 436f3d5..ba73da3 100644
a2f18f
--- a/ldap/servers/slapd/daemon.c
a2f18f
+++ b/ldap/servers/slapd/daemon.c
a2f18f
@@ -1026,7 +1026,7 @@ void slapd_daemon( daemon_ports_t *ports )
a2f18f
 	int threads;
a2f18f
 	int in_referral_mode = config_check_referral_mode();
a2f18f
 #ifdef ENABLE_NUNC_STANS
a2f18f
-	ns_thrpool_t *tp;
a2f18f
+	ns_thrpool_t *tp = NULL;
a2f18f
 	struct ns_thrpool_config tp_config;
a2f18f
 #endif
a2f18f
 	int connection_table_size = get_configured_connection_table_size();
a2f18f
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
a2f18f
index bc8c89d..f906c5a 100644
a2f18f
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
a2f18f
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
a2f18f
@@ -949,7 +949,7 @@ connectToServer (
a2f18f
       fprintf (stderr, "ldclt[%d]: T%03d: cannot ldap_unbind(), error=%d (%s)\n",
a2f18f
 			mctx.pid, tttctx->thrdNum, ret,strerror (ret));
a2f18f
       fflush (stderr);
a2f18f
-      addErrorStat(ret);
a2f18f
+      (void)addErrorStat(ret);
a2f18f
       return (-1);
a2f18f
     }
a2f18f
     tttctx->ldapCtx = NULL;
a2f18f
@@ -1942,7 +1942,7 @@ createMissingNodes (
a2f18f
     printf ("ldclt[%d]: T%03d: Cannot add (%s), error=%d (%s)\n",
a2f18f
 	mctx.pid, tttctx->thrdNum, nodeDN, ret, my_ldap_err2string (ret));
a2f18f
     fflush (stdout);
a2f18f
-    addErrorStat(ret);
a2f18f
+    (void)addErrorStat(ret);
a2f18f
     return (-1);
a2f18f
   }
a2f18f
 
a2f18f
-- 
a2f18f
1.9.3
a2f18f