diff --git a/CHANGES b/CHANGES
index 72f41f4676abf3da61830f64f2cf350ccb98c5a6..c3e80b16e0cb99f545aaa421a91cd9f866508a71 100644
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,7 @@ OpenLDAP 2.4.24 Engineering
 	Fixed slapd acl parsing overflow (ITS#6611)
 	Fixed slapd when first acl is value dependent (ITS#6693)
 	Fixed slapd modify to return actual error (ITS#6581)
+	Fixed slapd modify leaving rc uninitialized (ITS#6715)
 	Fixed slapd syncrepl reuse of presence list (ITS#6707)
 	Fixed slapd-bdb entry cache delete failure (ITS#6577)
 	Fixed slapd-ndb to honor rootpw setting (ITS#6661)
diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c
index 3b5f7271a0b118d903e88bfa6152eab5d55fca72..f459d938cf2b5cfe36d6f356a6562363b090183c 100644
--- a/servers/slapd/modify.c
+++ b/servers/slapd/modify.c
@@ -684,7 +684,7 @@ slap_sort_vals(
 	AttributeDescription *ad;
 	MatchingRule *mr;
 	int istack[sizeof(int)*16];
-	int i, j, k, l, ir, jstack, match, *ix, itmp, nvals, rc;
+	int i, j, k, l, ir, jstack, match, *ix, itmp, nvals, rc = LDAP_SUCCESS;
 	int is_norm;
 	struct berval a, *cv;
 
@@ -705,6 +705,8 @@ slap_sort_vals(
 
 	ad = ml->sml_desc;
 	nvals = ml->sml_numvals;
+	if ( nvals <= 1 )
+		goto ret;
 
 	/* For Modifications, sml_nvalues is NULL if normalization wasn't needed.
 	 * For Attributes, sml_nvalues == sml_values when normalization isn't needed.
@@ -834,15 +836,14 @@ slap_sort_vals(
 
 	slap_sl_free( ix, ctx );
 
-	if ( rc != LDAP_SUCCESS ) {
-		return rc;
-	} else if ( match == 0 ) {
+	if ( rc == LDAP_SUCCESS && match == 0 ) {
 		/* value exists already */
 		assert( i >= 0 );
 		assert( i < nvals );
-		return LDAP_TYPE_OR_VALUE_EXISTS;
+		rc = LDAP_TYPE_OR_VALUE_EXISTS;
 	}
-	return LDAP_SUCCESS;
+ ret:
+	return rc;
 }
 
 /* Enter with bv->bv_len = sizeof buffer, returns with