[tip:x86/boot] x86/boot: Fix minor fd leakage in tools/relocs.c

From: tip-bot for Cong Ding
Date: Sun Jan 27 2013 - 19:07:14 EST


Commit-ID: 65315d4889d403ea025081d8ca85ddf7b9c10f39
Gitweb: http://git.kernel.org/tip/65315d4889d403ea025081d8ca85ddf7b9c10f39
Author: Cong Ding <dinggnu@xxxxxxxxx>
AuthorDate: Mon, 14 Jan 2013 17:13:35 +0000
Committer: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
CommitDate: Sun, 27 Jan 2013 10:24:28 -0800

x86/boot: Fix minor fd leakage in tools/relocs.c

The opened file should be closed.

Signed-off-by: Cong Ding <dinggnu@xxxxxxxxx>
Cc: Kusanagi Kouichi <slash@xxxxxxxxxxxxxxx>
Cc: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxx>
Cc: Jiri Kosina <jkosina@xxxxxxx>
Cc: Matt Fleming <matt.fleming@xxxxxxxxx>
Link: http://lkml.kernel.org/r/1358183628-27784-1-git-send-email-dinggnu@xxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
arch/x86/tools/relocs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 5a1847d..79d67bd 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -814,12 +814,14 @@ int main(int argc, char **argv)
read_relocs(fp);
if (show_absolute_syms) {
print_absolute_symbols();
- return 0;
+ goto out;
}
if (show_absolute_relocs) {
print_absolute_relocs();
- return 0;
+ goto out;
}
emit_relocs(as_text, use_real_mode);
+out:
+ fclose(fp);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/