[newlib-cygwin] Cygwin: pty: Add missing DeleteProcThreadAttributeList() call

Takashi Yano via Cygwin-cvs <[email protected]> Wed, 15 Apr 2026 00:51:24 +0000 (GMT)
Newsgroups gmane.os.cygwin.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D11a835fbe48=
1018f7c50cee25e109df558da7ec2

commit 11a835fbe481018f7c50cee25e109df558da7ec2
Author: Takashi Yano <[email protected]>
Date:   Tue Apr 7 19:21:05 2026 +0900

    Cygwin: pty: Add missing DeleteProcThreadAttributeList() call
   =20
    Currently, the cleanup path of setup_pseudoconsole() is missing
    DeleteProcThreadAttributeList() call, while microsoft's document
    requires that and the normal path has it.
    https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/n=
f-processthreadsapi-initializeprocthreadattributelist
   =20
    This patch adds DeleteProcThreadAttributeList() call to the cleanup
    path.
   =20
    Fixes: bb4285206207 ("Cygwin: pty: Implement new pseudo console support=
.")
    Suggested-by: Johannes Schindelin <[email protected]>
    Signed-off-by: Takashi Yano <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/fhandler/pty.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index e9191aaad..cdfb363c9 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -3730,7 +3730,7 @@ fhandler_pty_slave::setup_pseudoconsole ()
 				      PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
 				      hpcon, sizeof (hpcon), NULL, NULL))
=20
-	goto cleanup_heap;
+	goto cleanup_proc_thread_attr;
=20
       hello =3D CreateEvent (&sec_none, true, false, NULL);
       goodbye =3D CreateEvent (&sec_none, true, false, NULL);
@@ -3899,6 +3899,8 @@ skip_close_hello:
   CloseHandle (goodbye);
   CloseHandle (hr);
   CloseHandle (hw);
+cleanup_proc_thread_attr:
+  DeleteProcThreadAttributeList (si.lpAttributeList);
 cleanup_heap:
   HeapFree (GetProcessHeap (), 0, si.lpAttributeList);
 cleanup_pseudo_console: