From 96961bf71d7e13d23dd497094257794504aeb673 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 6 Oct 2009 13:43:26 +0200 Subject: Fix descriptor leak when calling dlopen with RTLD_NOLOAD --- elf/dl-load.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'elf') diff --git a/elf/dl-load.c b/elf/dl-load.c index 0b896d9b47..597193c043 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -903,9 +903,12 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, #endif if (mode & RTLD_NOLOAD) - /* We are not supposed to load the object unless it is already - loaded. So return now. */ - return NULL; + { + /* We are not supposed to load the object unless it is already + loaded. So return now. */ + __close (fd); + return NULL; + } /* Print debugging message. */ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)) -- cgit 1.4.1