summary refs log tree commit diff
path: root/nss/nsswitch.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nsswitch.c')
-rw-r--r--nss/nsswitch.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 16e1caf50d..79c9d2706d 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -235,12 +235,17 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
 static int
 nss_dlerror_run (void (*operate) (void))
 {
-  const char *last_errstring = NULL;
+  char *last_errstring = NULL;
   const char *last_object_name = NULL;
+  int result;
 
   (void) _dl_catch_error (&last_errstring, &last_object_name, operate);
 
-  return last_errstring != NULL;
+  result = last_errstring != NULL;
+  if (result)
+    free (last_errstring);
+
+  return result;
 }