From 60e459b196947c9c9aaa6fd14ca682ddf9f7a492 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 15 May 2014 10:18:38 +0100 Subject: [PATCH] gresource-tool: Fix an FD leak in an error path Coverity issues: #1214054, #1214055, #1214056 --- gio/gresource-tool.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gio/gresource-tool.c b/gio/gresource-tool.c index f751f50..634a83a 100644 --- a/gio/gresource-tool.c +++ b/gio/gresource-tool.c @@ -151,10 +151,18 @@ get_elf (const gchar *file, elf = elf_begin (*fd, ELF_C_READ, NULL); if (elf == NULL) - return NULL; + { + g_close (*fd, NULL); + *fd = -1; + return NULL; + } if (elf_kind (elf) != ELF_K_ELF) - return NULL; + { + g_close (*fd, NULL); + *fd = -1; + return NULL; + } return elf; } -- 2.7.4