[krbdev.mit.edu #9016] [Comment] Memory leak in krb5_gss_inquire_cred

"Greg Hudson via RT" <[email protected]> Fri, 16 Jul 2021 12:13:09 -0400
Newsgroups gmane.comp.encryption.kerberos.bugs
Message-ID <rt-4.4.3-2-4111412-1626451989-911.9016-8-0@kerborg-prod-app-1.mit.edu>
http://kerborg-prod-app-1.mit.edu/rt/Ticket/Display.html?id=9016
This is a comment.  It is not sent to the Requestor(s):

This bug was introduced in commit 1cd2821c19b2b95e39d5fc2f451a035585a40fa5
("Make gss-krb5 use cache collection").  In the previous code, cred could be
an owner pointer or a casted alias to cred_handle, and the default cred was
freed with "if (cred_handle == NULL) krb5_gss_release_cred(minor_status, &
cred)" along the success and failure paths.  The aforementioned commit cleans
this up by introducing defcred as the owner pointer for the obtained default
credential; however, it neglected to update the freeing code along the success
path.  Since the new code also reassigns cred_handle when obtaining a default
cred, the old code does not trigger and the default credential is not freed.

It looks like it should be possible to unify the success and failure paths,
and I may do that rather than make the trivial fix.