Blame SOURCES/0068-Ticket-49551-fix-memory-leak-found-by-coverity.patch

058656
From a88eea7e06a8e0a7367b2d266f9db37f6d5bbb4a Mon Sep 17 00:00:00 2001
058656
From: Ludwig Krispenz <lkrispen@redhat.com>
058656
Date: Mon, 12 Feb 2018 16:27:03 +0100
058656
Subject: [PATCH] Ticket 49551 - fix memory leak found by coverity
058656
058656
---
058656
 ldap/servers/plugins/replication/repl5_replica.c | 5 +++++
058656
 1 file changed, 5 insertions(+)
058656
058656
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
058656
index 628fb9ceb..e3ddd783d 100644
058656
--- a/ldap/servers/plugins/replication/repl5_replica.c
058656
+++ b/ldap/servers/plugins/replication/repl5_replica.c
058656
@@ -3002,6 +3002,7 @@ process_reap_entry(Slapi_Entry *entry, void *cb_data)
058656
        if the value is set in the replica, we will know about it immediately */
058656
     PRBool *tombstone_reap_stop = ((reap_callback_data *)cb_data)->tombstone_reap_stop;
058656
     const CSN *deletion_csn = NULL;
058656
+    int deletion_csn_free = 0;
058656
     int rc = -1;
058656
 
058656
     /* abort reaping if we've been told to stop or we're shutting down */
058656
@@ -3024,6 +3025,7 @@ process_reap_entry(Slapi_Entry *entry, void *cb_data)
058656
         char *tombstonecsn = slapi_entry_attr_get_charptr(entry, SLAPI_ATTR_TOMBSTONE_CSN);
058656
         if (tombstonecsn) {
058656
             deletion_csn = csn_new_by_string(tombstonecsn);
058656
+            deletion_csn_free = 1;
058656
             slapi_ch_free_string(&tombstonecsn);
058656
         }
058656
     }
058656
@@ -3056,6 +3058,9 @@ process_reap_entry(Slapi_Entry *entry, void *cb_data)
058656
         /* Don't update the count for the database tombstone entry */
058656
         (*num_entriesp)++;
058656
     }
058656
+    if (deletion_csn_free) {
058656
+        csn_free(&deletion_csn);
058656
+    }
058656
 
058656
     return 0;
058656
 }
058656
-- 
058656
2.13.6
058656