Yes. The calling order was incorrect. It is supposed to be
No. Try this with the new code:
env LDAPHOST='host1 host2' valgrind clients/tools/ldapwhoami -x
It returns writes past malloced areas in ldap_str2charray().
options.c calls ldap_charray("host1 host2", ", ") to parse that.
It counted the number of commas and spaces in the host string.
With the new code, it instead sums up:
number of commas in "host1 host2"
+ number of commas in "ost1 host2"
+ number of commas in "st1 host2"
etc and you never count spaces.
Also the outside loop was incorrect.