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

Message ID 20230102100938.2778311-8-samuel.thibault@ens-lyon.org
State Committed, archived
Headers
Series hurd: fixes |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

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

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