about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-10-06 13:43:26 +0200
committerAndreas Schwab <schwab@redhat.com>2009-10-07 10:25:38 +0200
commit96961bf71d7e13d23dd497094257794504aeb673 (patch)
treef0aeb9bb2824907505002ab0ed1e45027434a934 /elf/dl-load.c
parentb0f3a2e43fb9de9a4a2f4dfbdb84b98994752bc4 (diff)
downloadglibc-96961bf71d7e13d23dd497094257794504aeb673.tar.gz
glibc-96961bf71d7e13d23dd497094257794504aeb673.tar.xz
glibc-96961bf71d7e13d23dd497094257794504aeb673.zip
Fix descriptor leak when calling dlopen with RTLD_NOLOAD
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c9
1 files changed, 6 insertions, 3 deletions
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))