From: John Kohl Date: Thu, 26 Apr 1990 17:19:14 +0000 (+0000) Subject: clean up & make work X-Git-Tag: krb5-1.0-alpha2~803 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ad1c151e557af7b55f2dbb810d7d738a59dd00f9;p=krb5.git clean up & make work git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@593 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/keytab/file/ktf_resolv.c b/src/lib/krb5/keytab/file/ktf_resolv.c index 956133aab..8d9b44bee 100644 --- a/src/lib/krb5/keytab/file/ktf_resolv.c +++ b/src/lib/krb5/keytab/file/ktf_resolv.c @@ -18,6 +18,8 @@ static char krb5_ktfile_resolve_c[] = #include #include +#include +#include #include "ktfile.h" @@ -28,19 +30,25 @@ krb5_ktfile_resolve(name, id) { krb5_ktfile_data *data; - if ((*id = malloc(sizeof(struct _krb5_kt))) == NULL) - return(KRB5_NO_MEMORY); /* XXX */ + if ((*id = (krb5_keytab) malloc(sizeof(**id))) == NULL) + return(ENOMEM); (*id)->ops = &krb5_ktf_ops; - if ((data = (krb5_ktfile_data *)malloc(sizeof(krb5_ktfile_data))) == NULL) - return(KRB5_NO_MEMORY); /* XXX */ + if ((data = (krb5_ktfile_data *)malloc(sizeof(krb5_ktfile_data))) == NULL) { + xfree(*id); + return(ENOMEM); + } - if ((data->name = (char *)calloc(strlen(name) + 1, sizeof(char))) == NULL) - return(KRB5_NO_MEMORY); /* XXX */ + if ((data->name = (char *)calloc(strlen(name) + 1, sizeof(char))) == NULL) { + xfree(data); + xfree(*id); + return(ENOMEM); + } (void) strcpy(data->name, name); + data->openf = 0; - id->data = (krb5_pointer)data; + (*id)->data = (krb5_pointer)data; return(0); /* XXX */ }