From 5f55b22f4b3ea14c777a60f239d25dc4555eb804 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 2 Jan 2023 01:59:53 +0100 Subject: hurd getcwd: Fix memory leak on error --- sysdeps/mach/hurd/getcwd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sysdeps/mach/hurd') diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index d11f744b2c..6ca364a418 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -274,6 +274,8 @@ __hurd_canonicalize_directory_name_internal (file_t thisdir, /* Set errno. */ (void) __hurd_fail (err); lose: + if (orig_size == 0) + free (file_name); cleanup (); return NULL; } -- cgit 1.4.1