res_config_ldap: Make memory allocation more consistent