1
0
Эх сурвалжийг харах

Bug 617630 - fix coverify Defect Type: Resource leaks issues CID 12052 - 12093

https://bugzilla.redhat.com/show_bug.cgi?id=617630
Resolves: bug 617630
Bug description: fix coverify Defect Type: Resource leaks issues CID 12080.
description: Fixed resource leaks in ldbm_instance_config_add_index_entry().
Endi S. Dewata 15 жил өмнө
parent
commit
0ebfd2fd75

+ 6 - 2
ldap/servers/slapd/back-ldbm/ldbm_index_config.c

@@ -623,6 +623,7 @@ int ldbm_instance_config_add_index_entry(
     char tmpMatchingRulesStr[1024];
     struct ldbminfo *li = inst->inst_li;
     char *dn = NULL;
+    int rc = 0;
 
     if ((argc < 2) || (NULL == argv) || (NULL == argv[0]) || 
         (NULL == argv[1])) {
@@ -652,7 +653,9 @@ int ldbm_instance_config_add_index_entry(
                       "instance %s\n",
                       basetype, inst->inst_li->li_plugin->plg_name,
                       inst->inst_name);
-            return -1;
+            slapi_ch_free((void**)&basetype);
+            rc = -1;
+            goto done;
         }
         eBuf = PR_smprintf(
                 "dn: %s\n"
@@ -683,6 +686,7 @@ int ldbm_instance_config_add_index_entry(
         slapi_ch_free((void**)&basetype);
     }
 
+done:
     if(NULL != attrs) {
         charray_free(attrs);
     }
@@ -692,7 +696,7 @@ int ldbm_instance_config_add_index_entry(
     if(NULL != matchingRules) {
         charray_free(matchingRules);
     }
-    return (0);
+    return rc;
 }
 
 int