andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From a2e116442a4a203cdafab3b1f1e1ceea7f9ccb37 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 9 May 2014 10:24:27 -0400
Subject: [PATCH 207/225] Ticket 47772 - fix coverity issue

12565 - resource leak
12564 - Explicit null dereferenced

https://fedorahosted.org/389/ticket/47772

Reviewed by: rmeggins(Thanks!)

(cherry picked from commit 24d44ba65398470fc8056b14b77b34b5d660f34e)
(cherry picked from commit ad5314fe74344005770356aebe479016395774cf)
---
 ldap/servers/plugins/replication/repl5_protocol_util.c | 5 +++--
 ldap/servers/slapd/modify.c                            | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ldap/servers/plugins/replication/repl5_protocol_util.c b/ldap/servers/plugins/replication/repl5_protocol_util.c
index 2fbe7c4..827ed58 100644
--- a/ldap/servers/plugins/replication/repl5_protocol_util.c
+++ b/ldap/servers/plugins/replication/repl5_protocol_util.c
@@ -689,16 +689,17 @@ protocol_response2string (int response)
 int
 repl5_strip_fractional_mods(Repl_Agmt *agmt, LDAPMod ** mods)
 {
-	char **a = agmt_get_fractional_attrs(agmt);
+	char **a;
 	char **attrs_to_strip;
 	int retval = 0;
 	int strip = 1;
 	int i, j, k;
 
 	if (mods == NULL) {
-                return retval;
+		return retval;
 	}
 
+	a = agmt_get_fractional_attrs(agmt);
 	if (a) {
 		/* Iterate through the fractional attr list */
 		for ( i = 0; a[i] != NULL; i++ ) 
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
index ab81434..817f17c 100644
--- a/ldap/servers/slapd/modify.c
+++ b/ldap/servers/slapd/modify.c
@@ -402,8 +402,8 @@ do_modify( Slapi_PBlock *pb )
 					 "mod includes invalid dn format", 0, NULL);
 			goto free_and_return;
 		}
+		slapi_pblock_set(pb, SLAPI_MODIFY_MODS, normalized_mods);
 	}
-	slapi_pblock_set(pb, SLAPI_MODIFY_MODS, normalized_mods);
 
 	op_shared_modify ( pb, pw_change, old_pw );
 
-- 
1.8.1.4