A patch for libdl bug.

H . J . Lu hjl@valinux.com
Fri Jun 9 13:40:00 GMT 2000


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);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlbug.tar.gz
Type: application/x-gzip
Size: 687 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20000609/51812dd4/attachment.bin>


More information about the Libc-hacker mailing list