Blame SOURCES/0059-Ticket-48964-should-not-free-repl-name-after-purging.patch

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