Index: samba-4.1.6+dfsg/source3/librpc/crypto/gse_krb5.c =================================================================== --- samba-4.1.6+dfsg.orig/source3/librpc/crypto/gse_krb5.c 2014-04-29 16:05:42.045043324 -0500 +++ samba-4.1.6+dfsg/source3/librpc/crypto/gse_krb5.c 2014-04-29 16:05:42.041043324 -0500 @@ -414,6 +414,10 @@ static krb5_error_code fill_mem_keytab_f if (ret) { DEBUG(1, (__location__ ": krb5_kt_start_seq_get failed (%s)\n", error_message(ret))); + if (keytab) { + krb5_kt_close(krbctx, keytab); + keytab = NULL; + } goto out; }