andykimpe / rpms / 389-ds-base

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