From 8bd6ba8f16ec7ae07118d5f0d552efe421b008a5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 20 Mar 2024 14:48:55 +0100 Subject: Cygwin: /proc: fix mem leak in opendir in error case Fixes: 1f08558f14e45 ("* fhandler.h (fhandler_proc::opendir): Declare.") Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler/proc.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc index cb75418..a508d4b 100644 --- a/winsup/cygwin/fhandler/proc.cc +++ b/winsup/cygwin/fhandler/proc.cc @@ -243,6 +243,8 @@ fhandler_proc::opendir (int fd) DIR *dir = fhandler_virtual::opendir (fd); if (dir && !(dir->__handle = (void *) new winpids ((DWORD) 0))) { + free (dir->__d_dirname); + free (dir->__d_dirent); free (dir); dir = NULL; set_errno (ENOMEM); -- cgit v1.1