9832fd
commit 273cdee86d86e107c0eecef5614f57e37567b54e
9832fd
Author: Andreas Schwab <schwab@suse.de>
9832fd
Date:   Tue Jan 15 16:39:07 2013 +0100
9832fd
9832fd
    Fix invalid free of memory allocated during rtld init
9832fd
9832fd
diff --git a/elf/dl-load.c b/elf/dl-load.c
9832fd
index 013efdb3814700d3..6a0005da502c8f37 100644
9832fd
--- a/elf/dl-load.c
9832fd
+++ b/elf/dl-load.c
9832fd
@@ -822,6 +822,9 @@ _dl_init_paths (const char *llp)
9832fd
 			   (const void *) (D_PTR (l, l_info[DT_STRTAB])
9832fd
 					   + l->l_info[DT_RUNPATH]->d_un.d_val),
9832fd
 			   l, "RUNPATH");
9832fd
+	  /* During rtld init the memory is allocated by the stub malloc,
9832fd
+	     prevent any attempt to free it by the normal malloc.  */
9832fd
+	  l->l_runpath_dirs.malloced = 0;
9832fd
 
9832fd
 	  /* The RPATH is ignored.  */
9832fd
 	  l->l_rpath_dirs.dirs = (void *) -1;
9832fd
@@ -838,6 +841,9 @@ _dl_init_paths (const char *llp)
9832fd
 			       (const void *) (D_PTR (l, l_info[DT_STRTAB])
9832fd
 					       + l->l_info[DT_RPATH]->d_un.d_val),
9832fd
 			       l, "RPATH");
9832fd
+	      /* During rtld init the memory is allocated by the stub
9832fd
+		 malloc, prevent any attempt to free it by the normal
9832fd
+		 malloc.  */
9832fd
 	      l->l_rpath_dirs.malloced = 0;
9832fd
 	    }
9832fd
 	  else