* [Qemu-devel] [PATCH 2/7] loader: fix a file descriptor leak
@ 2011-01-08 18:24 Blue Swirl
0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2011-01-08 18:24 UTC (permalink / raw)
To: qemu-devel
Fix a file descriptor leak, reported by cppcheck:
[/src/qemu/hw/loader.c:311]: (error) Resource leak: fd
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
hw/loader.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index eb198f6..35d792e 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -307,8 +307,9 @@ int load_elf(const char *filename, uint64_t
(*translate_fn)(void *, uint64_t),
target_data_order = ELFDATA2LSB;
}
- if (target_data_order != e_ident[EI_DATA])
- return -1;
+ if (target_data_order != e_ident[EI_DATA]) {
+ goto fail;
+ }
lseek(fd, 0, SEEK_SET);
if (e_ident[EI_CLASS] == ELFCLASS64) {
--
1.6.2.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-01-08 18:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-08 18:24 [Qemu-devel] [PATCH 2/7] loader: fix a file descriptor leak Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).