From 3c7d12e1167941ed76657340aedf2b458afc557a Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Tue, 15 Sep 2020 11:26:52 -0500 Subject: [PATCH] krb5: Fix FD leak in ENOMEM in stdio_from_fd --- lib/krb5/store_stdio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/krb5/store_stdio.c b/lib/krb5/store_stdio.c index 8c624cd9a..80323e1d8 100644 --- a/lib/krb5/store_stdio.c +++ b/lib/krb5/store_stdio.c @@ -215,8 +215,10 @@ krb5_storage_stdio_from_fd(int fd_in, const char *mode) return NULL; f = fdopen(fd, mode); - if (f == NULL) + if (f == NULL) { + (void) close(fd); return NULL; + } errno = saved_errno;