[glib] gresource-tool: Fix an FD leak in an error path
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gresource-tool: Fix an FD leak in an error path
- Date: Thu, 15 May 2014 13:38:46 +0000 (UTC)
commit 60e459b196947c9c9aaa6fd14ca682ddf9f7a492
Author: Philip Withnall <philip withnall collabora co uk>
Date: Thu May 15 10:18:38 2014 +0100
gresource-tool: Fix an FD leak in an error path
Coverity issues: #1214054, #1214055, #1214056
gio/gresource-tool.c | 12 ++++++++++--
1 files 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]