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

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