-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
aea099a
commit bfd2a69
Showing
7 changed files
with
51 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters