mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
gresource-tool: Fix an FD leak in an error path
Coverity issues: #1214054, #1214055, #1214056
This commit is contained in:
parent
46b7217fbf
commit
60e459b196
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user