about summary refs log tree commit diff
path: root/dlfcn/dlerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'dlfcn/dlerror.c')
-rw-r--r--dlfcn/dlerror.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index 972a9ac263..34ea82907e 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -120,9 +120,12 @@ _dlerror_run (void (*operate) (void *), void *args)
     }
 
   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 ((char *) 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 ((char *) result->errstring);
+      result->errstring = NULL;
+    }
 
   result->errcode = _dl_catch_error (&result->objname, &result->errstring,
 				     operate, args);