Need to _kt_close() after _kt_default() ?

Greg Hudson ghudson at
Sat Sep 17 15:23:59 EDT 2016

On 09/17/2016 07:32 AM, Rick van Rein wrote:
> According to the krb5 API description for krb5_kt_default(), "The key
> table is not opened."
> Still, valgrind reports a memory leak in my program, and points back to
> a calloc() inside krb5_kt_default().  When I call krb5_kt_close() on the
> keytab this leak is gone.
> Might this be a glitch in the documentation, or elsewhere?

You definitely need to krb5_kt_close() the handle.

"The key table is not opened" is probably trying to convey that the
keytab file is not opened (for a FILE keytab), meaning that the call
will succeed if the keytab file doesn't exist.  The documentation should
be clearer.  (One could argue that a generic keytab function shouldn't
talk about the behavior of the FILE keytab type at all, but then where
in the API documentation does that go?)

More information about the krbdev mailing list