From 2507ca66fb6b3f96f5e13968f309e2f8146ebd88 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Mon, 18 Dec 2006 23:11:28 +0000 Subject: [PATCH] pull up r18961 from trunk r18961@cathode-dark-space: epeisach | 2006-12-18 06:26:59 -0500 ticket: new subject: krb5_rc_io_open_internal on error will call close(-1) If there is an error in opening the replay cache - memory is freed, but close() is invoked with -1 (failure from open()). While technically, close() will return EBADF in such a case, and nothing bad will happen, valgrind picks up on this and provides an error... ticket: 5115 version_fixed: 1.6 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@18966 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/rc_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index 8453d1832..adc6a8c49 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -168,7 +168,9 @@ krb5_rc_io_creat(krb5_context context, krb5_rc_iostuff *d, char **fn) FREE(d->fn); d->fn = NULL; } - (void) close(d->fd); + if (d->fd != -1) { + (void) close(d->fd); + } } return retval; } -- 2.26.2