Commit 2c4e2fbf authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

ldap_sort_entries() should try to malloc(0) when the count is zero.

should also return error in ldap_count_entries returns an error.
parent 98f2462a
......@@ -91,6 +91,18 @@ ldap_sort_entries(
count = ldap_count_entries( ld, *chain );
if ( count < 0 ) {
if( ld != NULL ) {
ld->ld_errno = LDAP_PARAM_ERROR;
}
return -1;
} else if ( count < 2 ) {
/* zero or one entries -- already sorted! */
return 0;
}
if ( (et = (struct entrything *) malloc( count *
sizeof(struct entrything) )) == NULL ) {
ld->ld_errno = LDAP_NO_MEMORY;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment