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 12104
description: Fixed resource leaks in slapi_index_register_index().
Endi S. Dewata 15 years ago
parent
commit
881e40289b
1 changed files with 9 additions and 9 deletions
  1. 9 9
      ldap/servers/slapd/index_subsystem.c

+ 9 - 9
ldap/servers/slapd/index_subsystem.c

@@ -1056,6 +1056,15 @@ int slapi_index_register_index(char *plugin_id, indexed_item *registration_item,
 		goto bail;
 	}
 
+	/* map the namespace dn to a backend dn */
+	be = slapi_be_select( registration_item->namespace_dn );
+	
+	if(be == defbackend_get_backend())
+	{
+		ret = -1;
+		goto bail;
+	}
+
 	/* now add the new index - we shall assume indexes 
 	 * will not be registered twice by different plugins,
 	 * in that event, the last one added wins
@@ -1096,15 +1105,6 @@ int slapi_index_register_index(char *plugin_id, indexed_item *registration_item,
 	index->lookup_func = registration_item->search_op;
 	index->user_data = user_data;
 
-	/* map the namespace dn to a backend dn */
-	be = slapi_be_select( registration_item->namespace_dn );
-	
-	if(be == defbackend_get_backend())
-	{
-		ret = -1;
-		goto bail;
-	}
-
 	index->namespace_dn = (Slapi_DN*)slapi_be_getsuffix(be, 0);
 	
 	/* for now, we support simple filters only */