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

Takashi Yano tyan0@sourceware.org
Wed Apr 15 00:51:24 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=11a835fbe481018f7c50cee25e109df558da7ec2

commit 11a835fbe481018f7c50cee25e109df558da7ec2
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Tue Apr 7 19:21:05 2026 +0900

    Cygwin: pty: Add missing DeleteProcThreadAttributeList() call
    
    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/nf-processthreadsapi-initializeprocthreadattributelist
    
    This patch adds DeleteProcThreadAttributeList() call to the cleanup
    path.
    
    Fixes: bb4285206207 ("Cygwin: pty: Implement new pseudo console support.")
    Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
    Reviewed-by: Corinna Vinschen <corinna@vinschen.de>

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))
 
-	goto cleanup_heap;
+	goto cleanup_proc_thread_attr;
 
       hello = CreateEvent (&sec_none, true, false, NULL);
       goodbye = 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:


More information about the Cygwin-cvs mailing list