[newlib-cygwin/cygwin-3_6-branch] Cygwin: pty: Add missing DeleteProcThreadAttributeList() call

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

commit 4e279febca2443ce9f6a92b1ea7b095ea47b53bf
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]>
    (cherry picked from commit 11a835fbe481018f7c50cee25e109df558da7ec2)

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 7b000fe8d..4c10ae32d 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -3530,7 +3530,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);
@@ -3699,6 +3699,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: