When starting the 1st iteration through the keytab file after calling krb5_kt_default(), calls to krb5_get_init_creds_keytab() will NULL out the FILE * in the krb5_keytab structure. Subsequent iterations will crash the program with a NULL pointer dereference. See attached sample program.