From: Theodore Tso Date: Tue, 29 Sep 1992 13:48:55 +0000 (+0000) Subject: Change to alocate krb5_principal correctly. X-Git-Tag: krb5-1.0-beta2~43 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=381b21fcfd2accaf5792cdca43d4a4e4a5c95e6b;p=krb5.git Change to alocate krb5_principal correctly. Added missing error handler git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2419 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/stdio/scc_read.c b/src/lib/krb5/ccache/stdio/scc_read.c index b4ebffea9..d393c3f67 100644 --- a/src/lib/krb5/ccache/stdio/scc_read.c +++ b/src/lib/krb5/ccache/stdio/scc_read.c @@ -106,7 +106,7 @@ krb5_scc_read_principal(id, princ) tmpprinc = (krb5_principal) malloc(sizeof(krb5_principal_data)); if (tmpprinc == NULL) return KRB5_CC_NOMEM; - tmpprinc->data = malloc(length * sizeof(krb5_principal_data)); + tmpprinc->data = (krb5_data *) malloc(length * sizeof(krb5_data)); if (tmpprinc->data == 0) { free((char *)tmpprinc); return KRB5_CC_NOMEM; @@ -242,6 +242,10 @@ krb5_scc_read_data(id, data) } data->data[data->length] = 0; /* Null terminate just in case.... */ return KRB5_OK; + errout: + if (data->data) + xfree(data->data); + return kret; } krb5_error_code