gresource-tool: Fix an FD leak in an error path

Coverity issues: #1214054, #1214055, #1214056
This commit is contained in:
Philip Withnall 2014-05-15 10:18:38 +01:00
parent 46b7217fbf
commit 60e459b196

View File

@ -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;
}