From: John Kohl Date: Tue, 8 May 1990 13:42:41 +0000 (+0000) Subject: fix up confusion about errors and cur_entry X-Git-Tag: krb5-1.0-alpha2~627 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=38c6a48143fe4c614de4c697ddb2749f680cd422;p=krb5.git fix up confusion about errors and cur_entry git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@778 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/file/ktf_get_en.c b/src/lib/krb5/keytab/file/ktf_get_en.c index a4e919225..dad940c30 100644 --- a/src/lib/krb5/keytab/file/ktf_get_en.c +++ b/src/lib/krb5/keytab/file/ktf_get_en.c @@ -37,8 +37,6 @@ OLDDECLARG(krb5_keytab_entry *, entry) krb5_keytab_entry *cur_entry; krb5_error_code kerror = 0; /* XXX */ - bzero((char *)&cur_entry, sizeof(krb5_keytab_entry)); - /* Open the keyfile for reading */ if (kerror = krb5_ktfileint_openr(id)) return(kerror); /* XXX */ @@ -48,6 +46,7 @@ OLDDECLARG(krb5_keytab_entry *, entry) * is exited with a break statement. */ while (TRUE) { + cur_entry = 0; if (kerror = krb5_ktfileint_read_entry(id, &cur_entry)) break; @@ -63,8 +62,11 @@ OLDDECLARG(krb5_keytab_entry *, entry) return kerror; } if (!(kerror = krb5_ktfileint_close(id))) { - *entry = *cur_entry; - xfree(cur_entry); + if (cur_entry) { + *entry = *cur_entry; + xfree(cur_entry); + } else + kerror = KRB5_KT_NOTFOUND; } else krb5_kt_free_entry(cur_entry); return kerror;