andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 19c9f4992e3e78005e2d7c1273e2561a84cfdd0d Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Wed, 4 Jan 2017 09:41:38 -0500
dc8c34
Subject: [PATCH 423/425] Ticket 48964 - should not free repl name after
dc8c34
 purging changelog
dc8c34
dc8c34
Bug Description:  The previous commit for this ticket incorrectly
dc8c34
                  freed a replica struct const char.  There was also
dc8c34
                  a minor converity issue.
dc8c34
dc8c34
Fix Description:  Do not free the repl_name after purging, and do
dc8c34
                  not check if "replica" is NULL when creating the
dc8c34
                  purge data.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48964
dc8c34
dc8c34
Reviewed by: tbordaz(Thanks!)
dc8c34
dc8c34
(cherry picked from commit 017469a1a055da03fc3fb4b34a7732611b7bd2b0)
dc8c34
(cherry picked from commit d4d10723bcea672739fe3407390caac392d1acfe)
dc8c34
---
dc8c34
 ldap/servers/plugins/replication/cl5_api.c              |  1 -
dc8c34
 ldap/servers/plugins/replication/repl5_replica_config.c | 14 ++++++--------
dc8c34
 2 files changed, 6 insertions(+), 9 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
dc8c34
index 3c46ed3..9b2ef37 100644
dc8c34
--- a/ldap/servers/plugins/replication/cl5_api.c
dc8c34
+++ b/ldap/servers/plugins/replication/cl5_api.c
dc8c34
@@ -6888,7 +6888,6 @@ cl5CleanRUV(ReplicaId rid){
dc8c34
 static void free_purge_data(cleanruv_purge_data *purge_data)
dc8c34
 {
dc8c34
     slapi_ch_free_string(&purge_data->replGen);
dc8c34
-    slapi_ch_free_string(&purge_data->replName);
dc8c34
     slapi_ch_free((void **)&purge_data);
dc8c34
 }
dc8c34
 
dc8c34
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
dc8c34
index c6a9ffa..bd20b8a 100644
dc8c34
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
dc8c34
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
dc8c34
@@ -1245,14 +1245,12 @@ replica_execute_cleanruv_task (Object *r, ReplicaId rid, char *returntext /* not
dc8c34
 	/*
dc8c34
 	 * Now purge the changelog.  The purging thread will free the purge_data
dc8c34
 	 */
dc8c34
-	if (replica){
dc8c34
-		purge_data = (cleanruv_purge_data*)slapi_ch_calloc(1, sizeof(cleanruv_purge_data));
dc8c34
-		purge_data->cleaned_rid = rid;
dc8c34
-		purge_data->suffix_sdn = replica_get_root(replica);
dc8c34
-		purge_data->replName = (char *)replica_get_name(replica);
dc8c34
-		purge_data->replGen = replica_get_generation(replica);
dc8c34
-		trigger_cl_purging(purge_data);
dc8c34
-	}
dc8c34
+	purge_data = (cleanruv_purge_data*)slapi_ch_calloc(1, sizeof(cleanruv_purge_data));
dc8c34
+	purge_data->cleaned_rid = rid;
dc8c34
+	purge_data->suffix_sdn = replica_get_root(replica);
dc8c34
+	purge_data->replName = (char *)replica_get_name(replica);
dc8c34
+	purge_data->replGen = replica_get_generation(replica);
dc8c34
+	trigger_cl_purging(purge_data);
dc8c34
 
dc8c34
 	if (rc != RUV_SUCCESS){
dc8c34
 		slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "cleanruv_task: task failed(%d)\n",rc);
dc8c34
-- 
dc8c34
2.9.3
dc8c34