Browse Source

Bug 616500 - fix coverify Defect Type: Resource leaks issues CID 12094 - 12136

https://bugzilla.redhat.com/show_bug.cgi?id=616500
Resolves: bug 616500
Bug description: fix coverify Defect Type: Resource leaks issues CID 12095, 12096, 12097.
description: Fixed resource leaks in vlv_AddSearchEntry(), vlv_init_index_entry(), and vlv_init_search_entry().
Endi S. Dewata 15 years ago
parent
commit
0ac7d95941
1 changed files with 3 additions and 0 deletions
  1. 3 0
      ldap/servers/slapd/back-ldbm/vlv.c

+ 3 - 0
ldap/servers/slapd/back-ldbm/vlv.c

@@ -77,6 +77,7 @@ int vlv_AddSearchEntry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
     backend *be = inst->inst_be;
     
     if (NULL == be) { /* backend is not associated */
+        vlvSearch_delete(&newVlvSearch);
         return SLAPI_DSE_CALLBACK_ERROR;
     }
     vlvSearch_init(newVlvSearch, pb, entryBefore, inst);
@@ -264,6 +265,7 @@ vlv_init_index_entry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* en
 		if (pSearch == NULL) { 
 			LDAPDebug( LDAP_DEBUG_ANY, "Parent doesn't exist for entry %s.\n",
 				escape_string(slapi_entry_get_dn(entryBefore), ebuf), 0, 0); 
+			vlvIndex_delete(&newVlvIndex);
 		} 
 		else { 
 			vlvIndex_init(newVlvIndex, be, pSearch, entryBefore);
@@ -284,6 +286,7 @@ vlv_init_search_entry(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e
 	backend *be= inst->inst_be;
 
     if (NULL == be) { /* backend is not associated */
+        vlvSearch_delete(&newVlvSearch);
         return SLAPI_DSE_CALLBACK_ERROR;
     }
     vlvSearch_init(newVlvSearch, pb, entryBefore, inst);