From a3d8ec9635ec0810ccf94f0b268d45020cefcb47 Mon Sep 17 00:00:00 2001 From: John Kohl Date: Tue, 1 May 1990 17:03:09 +0000 Subject: [PATCH] fix openclose stuff use xfree git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@644 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/file/fcc_close.c | 13 +++++++------ src/lib/krb5/ccache/file/fcc_destry.c | 6 +++--- src/lib/krb5/ccache/file/fcc_eseq.c | 6 ++++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/lib/krb5/ccache/file/fcc_close.c b/src/lib/krb5/ccache/file/fcc_close.c index 4a6a39053..4c53421c2 100644 --- a/src/lib/krb5/ccache/file/fcc_close.c +++ b/src/lib/krb5/ccache/file/fcc_close.c @@ -11,7 +11,7 @@ */ #if !defined(lint) && !defined(SABER) -static char fcc_resolve_c[] = "$Id$"; +static char fcc_close_c[] = "$Id$"; #endif /* !lint && !SABER */ #include @@ -30,12 +30,13 @@ krb5_error_code krb5_fcc_close(id) krb5_ccache id; { - if (OPENCLOSE(id)) + if (OPENCLOSE(id)) { close(((krb5_fcc_data *) id->data)->fd); - - free(((krb5_fcc_data *) id->data)->filename); - free(((krb5_fcc_data *) id->data)); - free(id); + ((krb5_fcc_data *) id->data)->fd = -1; + } + xfree(((krb5_fcc_data *) id->data)->filename); + xfree(((krb5_fcc_data *) id->data)); + xfree(id); return KRB5_OK; } diff --git a/src/lib/krb5/ccache/file/fcc_destry.c b/src/lib/krb5/ccache/file/fcc_destry.c index 23c9a88cc..e8f6938ea 100644 --- a/src/lib/krb5/ccache/file/fcc_destry.c +++ b/src/lib/krb5/ccache/file/fcc_destry.c @@ -34,10 +34,10 @@ krb5_error_code krb5_fcc_destroy(id) int ret, i; if (OPENCLOSE(id)) { - ((krb5_fcc_data *) id->data)->fd = open(((krb5_fcc_data *) id->data) - ->filename, O_RDWR, 0); - if (((krb5_fcc_data *) id->data)->fd < 0) + ret = open(((krb5_fcc_data *) id->data)->filename, O_RDWR, 0); + if (ret < 0) return errno; + ((krb5_fcc_data *) id->data)->fd = ret; } else lseek(((krb5_fcc_data *) id->data)->fd, 0, L_SET); diff --git a/src/lib/krb5/ccache/file/fcc_eseq.c b/src/lib/krb5/ccache/file/fcc_eseq.c index 7f9db3c10..95c97c98e 100644 --- a/src/lib/krb5/ccache/file/fcc_eseq.c +++ b/src/lib/krb5/ccache/file/fcc_eseq.c @@ -35,10 +35,12 @@ krb5_fcc_end_seq_get(id, cursor) krb5_ccache id; krb5_cc_cursor *cursor; { - if (OPENCLOSE(id)) + if (OPENCLOSE(id)) { close(((krb5_fcc_data *) id->data)->fd); + ((krb5_fcc_data *) id->data)->fd = -1; + } - free((krb5_fcc_cursor *) *cursor); + xfree((krb5_fcc_cursor *) *cursor); return KRB5_OK; } -- 2.26.2