From: Ulrich Drepper Date: Tue, 30 Jan 2007 16:18:13 +0000 (+0000) Subject: Fix file descriptor leak in nlist. X-Git-Tag: elfutils-0.126~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8e382f9c2c6dafc6982d8dd696c570a69060069;p=thirdparty%2Felfutils.git Fix file descriptor leak in nlist. --- 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')