From 6290148886080d7b1d8b1c56c1da5287f79e2e80 Mon Sep 17 00:00:00 2001 From: Sunmin Lee Date: Fri, 17 Jun 2016 12:49:47 +0900 Subject: [PATCH] crash-stack: Fix handle leak Fix vulnerablility caused by handle leak of file. Change-Id: I037f547633f1d7f074eb63a5dcad2d9b921bfc1a Signed-off-by: Sunmin Lee --- src/crash-stack/crash-stack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/crash-stack/crash-stack.c b/src/crash-stack/crash-stack.c index 76ce25d..a9e5b2d 100644 --- a/src/crash-stack/crash-stack.c +++ b/src/crash-stack/crash-stack.c @@ -169,8 +169,10 @@ static char *try_symbol_from_elfs (Elf *core, Elf_Data *notes, uintptr_t address elf = elf_begin (fd, ELF_C_READ_MMAP, NULL); - if (NULL == elf) + if (NULL == elf) { + close(fd); return NULL; + } Elf_Scn *scn = NULL; *module_name = filenames; -- 2.7.4