This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

A patch for libdl bug.


This patch applies to elf/dlerror.c in glibc 2.1 and dlfcn/dlerror.c
in glibc 2.2. I am enclosing a testcase here.


H.J.
---
2000-06-09  H.J. Lu  <hjl@gnu.org>

	* elf/dlerror.c (_dlerror_run): Set result->errstring to NULL
	after freeing it.

Index: elf/dlerror.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/elf/dlerror.c,v
retrieving revision 1.1.1.8
diff -u -p -r1.1.1.8 dlerror.c
--- elf/dlerror.c	1999/08/02 16:06:18	1.1.1.8
+++ elf/dlerror.c	2000/06/09 18:31:35
@@ -118,9 +118,12 @@ _dlerror_run (void (*operate) (void *), 
     }
 
   if (result->errstring != NULL)
-    /* Free the error string from the last failed command.  This can
-       happen if `dlerror' was not run after an error was found.  */
-    free (result->errstring);
+    {
+      /* Free the error string from the last failed command.  This can
+	 happen if `dlerror' was not run after an error was found.  */
+      free (result->errstring);
+      result->errstring = NULL;
+    }
 
   result->errcode = _dl_catch_error (&result->errstring, operate, args);
 

dlbug.tar.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]