From: Ezra Peisach Date: Mon, 18 Dec 2006 11:26:59 +0000 (+0000) Subject: krb5_rc_io_open_internal on error will call close(-1) X-Git-Tag: krb5-1.7-alpha1~1397 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=45adade7736d99462e60694df87ba28eb5753b4f;p=krb5.git 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: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18961 dc483132-0cff-0310-8789-dd5450dbe970 --- 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; }