From: Blue Swirl Date: Wed, 12 Jan 2011 19:48:57 +0000 (+0000) Subject: loader: fix a file descriptor leak X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~6728 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cedf9a6f4549900f857954059284a96814e4c7a3;p=sdk%2Femulator%2Fqemu.git 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 --- 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) {