Fix several memory leaks in LDAP KDB modules

Fix memory leaks discovered by running valgrind over kdbtest, and some
related leaks.  Many of them result from not calling ldap_msgfree
after an unsuccessful search (as the OpenLDAP documentation requires)
or after an exception following a search, so many of the fixes move or
add ldap_msgfree calls to cleanup labels.

ldap_osa_free_princ_ent was not used, and could not be used because it
frees the container while krb5_lookup_tl_kadm_data uses a
caller-allocated container.  Change it to leave the container alone,
but to correctly destroy xdrs.  Use it in krb5_ldap_put_principal
where princ_ent was leaked.

In krb5_ldap_put_principal, subtreelist is declared twice in interior
scopes and not properly freed; move it to function scope and free it
up in the cleanup label.  Also in krb5_ldap_put_principal, avoiding
decoding multiple KBR5_TL_KADM_DATA values (which we don't expect to
see) as later decodes would cause earlier decodes to leak.

In krb5_encode_krbsecretkey, fix a leak of the krb5_data container and
also add an error check when calling asn1_encode_sequence_of_keys;
otherwise we would dereference a null pointer if we run out of memory
encoding keys (very unlikely).

ticket: 7941 (new)
target_version: 1.12.2
tags: pullup
Remove unused variables

[ghudson@mit.edu: squashed with similar commits]
Fix invalid test strings in t_oid.c

A missing comma caused two invalid strings to be concatenated.  The
resulting string was still invalid so the tests passed.

[ghudson@mit.edu: clarified commit message]
Fix error handling in k5_expand_path_tokens_extra

If strdup fails when copying extra tokens, we must terminate the
argument traversal before returning.

[ghudson@mit.edu: clarified commit message]
Fix argment validation in krb5_make_fulladdr

Check kaddr and kport, not kport twice.

[ghudson@mit.edu: clarified commit message, minor style change]
Avoid closing fd -1 in libkrad

If a krad_remote is released before its fd is set, we could close the
file descriptor -1, which is harmless but incorrect.  Check the fd in
remote_disconnect to avoid this.

[ghudson@mit.edu: clarified commit message, minor style change]
Fix error check in krb5_ldap_parse_principal_name

Test the correct variable for NULL to detect a strdup failure.

[ghudson@mit.edu: clarified commit message]
Merge from 'krb5/master' to update fork