From 9d5fc8a90860aa3411f7a300f23acad855de2e67 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Wed, 10 Apr 2013 11:01:12 -0700 Subject: [PATCH 45/47] Ticket 623 - cleanAllRUV task fails to cleanup config upon completion Coverity defect: 13161: Resource leak Description: commit d5fe6ba773ef2655845df5152901fd5bb6a9d4e9 (coverity fix for "13158 - Logically dead code') introduced this resource leak. Free csnstr before assiging strdup'ed string. https://fedorahosted.org/389/ticket/623 Reviewed by Rich (Thank you!!) (cherry picked from commit 288fb33afc715cb5399c600a8065247bb852d87c) --- ldap/servers/plugins/replication/repl5_replica_config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c index 0e29c6f..bbbe87e 100644 --- a/ldap/servers/plugins/replication/repl5_replica_config.c +++ b/ldap/servers/plugins/replication/repl5_replica_config.c @@ -2368,7 +2368,8 @@ delete_cleaned_rid_config(cleanruv_data *clean_data) * If there is no maxcsn, set the proper csnstr */ csnstr = csn_as_string(clean_data->maxcsn, PR_FALSE, csnstr); - if(csnstr == NULL || csn_get_replicaid(clean_data->maxcsn) == 0){ + if ((csnstr == NULL) || (csn_get_replicaid(clean_data->maxcsn) == 0)) { + slapi_ch_free_string(&csnstr); /* no problem to pass NULL */ csnstr = slapi_ch_strdup("00000000000000000000"); } /* -- 1.8.1.4