diff --git a/lib/hdb/mkey.c b/lib/hdb/mkey.c index 895f78f58..8265776bf 100644 --- a/lib/hdb/mkey.c +++ b/lib/hdb/mkey.c @@ -129,19 +129,16 @@ read_master_keytab(krb5_context context, const char *filename, goto out; while(krb5_kt_next_entry(context, id, &entry, &cursor) == 0) { p = calloc(1, sizeof(*p)); - if(p == NULL) { - krb5_kt_end_seq_get(context, id, &cursor); + if (p == NULL) { ret = ENOMEM; - goto out; + break; } p->keytab = entry; - ret = krb5_crypto_init(context, &p->keytab.keyblock, 0, &p->crypto); - if (ret) { - krb5_kt_end_seq_get(context, id, &cursor); - goto out; - } p->next = *mkey; *mkey = p; + ret = krb5_crypto_init(context, &p->keytab.keyblock, 0, &p->crypto); + if (ret) + break; } krb5_kt_end_seq_get(context, id, &cursor); out: