From a8e382f9c2c6dafc6982d8dd696c570a69060069 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 30 Jan 2007 16:18:13 +0000 Subject: [PATCH] Fix file descriptor leak in nlist. --- libelf/ChangeLog | 4 ++++ libelf/nlist.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index f3cf68972..8d1f289d1 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,7 @@ +2007-01-30 Ulrich Drepper + + * nlist.c: Close file descriptor before returning. + 2006-10-13 Roland McGrath * elf32_updatenull.c: Look for and accept phdr also for ET_CORE. diff --git a/libelf/nlist.c b/libelf/nlist.c index fd2209dfa..b3a6af0d6 100644 --- a/libelf/nlist.c +++ b/libelf/nlist.c @@ -230,6 +230,9 @@ nlist (const char *filename, struct nlist *nl) /* We do not need the ELF descriptor anymore. */ (void) INTUSE(elf_end) (elf); + /* Neither the file descriptor. */ + (void) close (fd); + return 0; fail_dealloc: @@ -239,6 +242,9 @@ nlist (const char *filename, struct nlist *nl) /* We do not need the ELF descriptor anymore. */ (void) INTUSE(elf_end) (elf); + /* Neither the file descriptor. */ + (void) close (fd); + fail: /* We have to set all entries to zero. */ while (nl->n_name != NULL && nl->n_name[0] != '\0') -- 2.47.2