diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2011-01-12 19:48:57 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-01-12 19:48:57 +0000 |
commit | cedf9a6f4549900f857954059284a96814e4c7a3 (patch) | |
tree | 173bbe45d92837482233a7e5b3139d7b715428f4 | |
parent | 8ce7d35273352ebe19c871e6b32a52db77fa08c3 (diff) |
loader: fix a file descriptor leak
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>
-rw-r--r-- | hw/loader.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/loader.c b/hw/loader.c index eb198f6723..35d792e647 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) { |