andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

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

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