[Ttssh2-commit] [7709] CreateProcess() で発生するハンドルリークを修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 5月 22日 (水) 22:32:55 JST


Revision: 7709
          https://osdn.net/projects/ttssh2/scm/svn/commits/7709
Author:   zmatsuo
Date:     2019-05-22 22:32:53 +0900 (Wed, 22 May 2019)
Log Message:
-----------
CreateProcess() で発生するハンドルリークを修正

Modified Paths:
--------------
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2019-05-22 10:38:09 UTC (rev 7708)
+++ trunk/teraterm/teraterm/vtwin.cpp	2019-05-22 13:32:53 UTC (rev 7709)
@@ -4085,6 +4085,9 @@
 		             "Can't execute Tera Term. (%d)", ts.UILanguageFile);
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 }
 
@@ -4172,6 +4175,9 @@
 		get_lang_msg("MSG_EXEC_CYGTERM_ERROR", ts.UIMsg, sizeof(ts.UIMsg),
 		             "Can't execute Cygterm.", ts.UILanguageFile);
 		::MessageBox(NULL, ts.UIMsg, uimsg, MB_OK | MB_ICONWARNING);
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 }
 
@@ -4198,6 +4204,9 @@
 		             "Can't execute TeraTerm Menu. (%d)", ts.UILanguageFile);
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 }
 
@@ -4227,6 +4236,9 @@
 		             "Can't execute LogMeTT. (%d)", ts.UILanguageFile);
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 }
 
@@ -4315,6 +4327,9 @@
 		             "Can't view logging file. (%d)", ts.UILanguageFile);
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 }
 
@@ -4372,6 +4387,9 @@
 		             "Can't execute Tera Term. (%d)", ts.UILanguageFile);
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, GetLastError());
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 }
 
@@ -4972,6 +4990,9 @@
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE, ts.UIMsg, no);
 		::MessageBox(NULL, buf, uimsg, MB_OK | MB_ICONWARNING);
 		goto error;
+	} else {
+		CloseHandle(pi.hThread);
+		CloseHandle(pi.hProcess);
 	}
 
 	ret = TRUE;


Ttssh2-commit メーリングリストの案内
Back to archive index