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

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