about summary refs log tree commit diff
path: root/elf/dlerror.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-08-26 10:28:45 +0000
committerUlrich Drepper <drepper@redhat.com>1996-08-26 10:28:45 +0000
commitdcf0671d905200c449f92ead6cf43c184637a0d5 (patch)
tree91dc217311db41e89545d487b991865a6433205e /elf/dlerror.c
parent4884d0f03c5a3b3d2459655e76fa2d0684d389dc (diff)
downloadglibc-dcf0671d905200c449f92ead6cf43c184637a0d5.tar.gz
glibc-dcf0671d905200c449f92ead6cf43c184637a0d5.tar.xz
glibc-dcf0671d905200c449f92ead6cf43c184637a0d5.zip
handle password file locking. cvs/libc-960826
Diffstat (limited to 'elf/dlerror.c')
-rw-r--r--elf/dlerror.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/elf/dlerror.c b/elf/dlerror.c
index 4ec5037de4..663207d708 100644
--- a/elf/dlerror.c
+++ b/elf/dlerror.c
@@ -1,5 +1,5 @@
 /* dlerror -- Return error detail for failing <dlfcn.h> functions.
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -58,6 +58,7 @@ dlerror (void)
 	   ? NULL : buf);
 
   /* Reset the error indicator.  */
+  free (last_errstring);
   last_errstring = NULL;
   return ret;
 }
@@ -65,6 +66,11 @@ dlerror (void)
 int
 _dlerror_run (void (*operate) (void))
 {
+  if (last_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 (last_errstring);
+
   last_errcode = _dl_catch_error (&last_errstring, &last_object_name,
 				  operate);
   return last_errstring != NULL;