Explorar o código

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!!)
Noriko Hosoi %!s(int64=12) %!d(string=hai) anos
pai
achega
288fb33afc
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      ldap/servers/plugins/replication/repl5_replica_config.c

+ 2 - 1
ldap/servers/plugins/replication/repl5_replica_config.c

@@ -2397,7 +2397,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");
     }
     /*