Skip to content
Snippets Groups Projects
Commit 20248e74 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Move delete of last value check out of inner loop.

parent f48f00f9
No related branches found
No related tags found
No related merge requests found
......@@ -379,26 +379,17 @@ delete_values(
if( rc == LDAP_SUCCESS && match != 0 ) {
continue;
}
/* found a matching value */
found = 1;
/* found a matching value - delete it */
/* delete it */
ber_bvfree( a->a_vals[j] );
for ( k = j + 1; a->a_vals[k] != NULL; k++ ) {
a->a_vals[k - 1] = a->a_vals[k];
}
a->a_vals[k - 1] = NULL;
/* delete the entire attribute, if no values remain */
if ( a->a_vals[0] == NULL) {
Debug( LDAP_DEBUG_ARGS,
"removing entire attribute %s\n",
desc, 0, 0 );
if ( attr_delete( &e->e_attrs, mod->sm_desc ) ) {
ber_bvfree( asserted );
return LDAP_NO_SUCH_ATTRIBUTE;
}
}
break;
}
......@@ -413,6 +404,16 @@ delete_values(
}
}
/* if no values remain, delete the entire attribute */
if ( a->a_vals[0] == NULL ) {
Debug( LDAP_DEBUG_ARGS,
"removing entire attribute %s\n",
desc, 0, 0 );
if ( attr_delete( &e->e_attrs, mod->sm_desc ) ) {
return LDAP_NO_SUCH_ATTRIBUTE;
}
}
return LDAP_SUCCESS;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment