From: Andreas Schwab Date: Tue, 6 Oct 2009 11:43:26 +0000 (+0200) Subject: Fix descriptor leak when calling dlopen with RTLD_NOLOAD X-Git-Tag: upstream/2.30~13275 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96961bf71d7e13d23dd497094257794504aeb673;p=external%2Fglibc.git Fix descriptor leak when calling dlopen with RTLD_NOLOAD --- diff --git a/ChangeLog b/ChangeLog index 7192970..934a866 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-06 Andreas Schwab + + * elf/dl-load.c (_dl_map_object_from_fd): Close fd before + returning if RTLD_NOLOAD. + 2009-10-06 Roland McGrath * sysdeps/x86_64/multiarch/strstr-c.c diff --git a/elf/dl-load.c b/elf/dl-load.c index 0b896d9..597193c 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))