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

Ticket 48745 - Matching Rule caseExactIA5Match indexes incorrectly values with upper cases

Description: Fixing a minor coverity defect introduced by #48745.
> Defect type: REVERSE_INULL
> plugin_mr.c:671: check_after_deref: Null-checking "pi" suggests that
> it may be null, but it has already been dereferenced on all paths
> leading to the check.
Moving the NULL check back to the original position.
Noriko Hosoi 9 жил өмнө
parent
commit
a0b8f4698e

+ 12 - 12
ldap/servers/slapd/plugin_mr.c

@@ -655,23 +655,23 @@ default_mr_indexer_create(Slapi_PBlock* pb)
 {
 	int rc = -1;
 	struct slapdplugin *pi = NULL;
-        char* oid = NULL;
-	
+	char* oid = NULL;
+
 	slapi_pblock_get(pb, SLAPI_PLUGIN, &pi);
-        slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &oid);
-        /* this default_mr_indexer_create can be common indexer create to several
-         * MR plugin. We need to check the selected plugin handle the expected OID
-         */
-        if ( oid == NULL || !charray_inlist(pi->plg_mr_names, oid)) {
-            LDAPDebug2Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: warning - plugin [%s] does not handle %s\n",
-                    pi->plg_name,
-                    oid ? oid : "unknown oid");
-            goto done;
-        }
 	if (NULL == pi) {
 		LDAPDebug0Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: error - no plugin specified\n");
 		goto done;
 	}
+	slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &oid);
+	/* this default_mr_indexer_create can be common indexer create to several
+	 * MR plugin. We need to check the selected plugin handle the expected OID
+	 */
+	if ( oid == NULL || !charray_inlist(pi->plg_mr_names, oid)) {
+	    LDAPDebug2Args(LDAP_DEBUG_ANY, "default_mr_indexer_create: warning - plugin [%s] does not handle %s\n",
+		    pi->plg_name,
+		    oid ? oid : "unknown oid");
+	    goto done;
+	}
 
 	if (NULL == pi->plg_mr_values2keys) {
 		LDAPDebug1Arg(LDAP_DEBUG_ANY, "default_mr_indexer_create: error - plugin [%s] has no plg_mr_values2keys function\n",