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