diff mbox series

[hurd,commited,7/7] hurd getcwd: Fix memory leak on error

Message ID 20230102100938.2778311-8-samuel.thibault@ens-lyon.org
State New
Headers show
Series hurd: fixes | expand

Commit Message

Samuel Thibault Jan. 2, 2023, 10:09 a.m. UTC
---
 sysdeps/mach/hurd/getcwd.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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;
 }