Alex Ionescu <alex.ionescu@reactos.org>
Filip Navara <navaraf@reactos.org>

Don't leak handles after calling CreateProcess.

Index: src/TortoiseShell/SVNPropertyPage.cpp
===================================================================
--- src/TortoiseShell/SVNPropertyPage.cpp	(revision 5085)
+++ src/TortoiseShell/SVNPropertyPage.cpp	(working copy)
@@ -473,7 +473,11 @@
 						svnCmd += _T("log /path:\"");
 						svnCmd += filenames.front().c_str();
 						svnCmd += _T("\"");
-						CreateProcess(tortoiseProcPath, const_cast<TCHAR*>(svnCmd.c_str()), NULL, NULL, FALSE, 0, 0, 0, &startup, &process);
+						if (CreateProcess(tortoiseProcPath, const_cast<TCHAR*>(svnCmd.c_str()), NULL, NULL, FALSE, 0, 0, 0, &startup, &process))
+						{
+							CloseHandle(process.hThread);
+							CloseHandle(process.hProcess);
+						}
 					}
 				case EN_CHANGE:
 					if ((LOWORD(wParam) == IDC_EDITNAME)||(LOWORD(wParam) == IDC_EDITVALUE))
Index: src/TortoiseShell/ContextMenu.cpp
===================================================================
--- src/TortoiseShell/ContextMenu.cpp	(revision 5085)
+++ src/TortoiseShell/ContextMenu.cpp	(working copy)
@@ -1296,6 +1296,8 @@
 					MessageBox( NULL, (LPCTSTR)lpMsgBuf, _T("Error"), MB_OK | MB_ICONINFORMATION );
 					LocalFree( lpMsgBuf );
 				} // if (CreateProcess(tortoiseMergePath, const_cast<TCHAR*>(svnCmd.c_str()), NULL, NULL, FALSE, 0, 0, 0, &startup, &process)==0) 
+				CloseHandle(process.hThread);
+				CloseHandle(process.hProcess);
 				return NOERROR;
 				break;
 			case RevisionGraph:
@@ -1351,6 +1353,8 @@
 				MessageBox( NULL, (LPCTSTR)lpMsgBuf, _T("Error"), MB_OK | MB_ICONINFORMATION );
 				LocalFree( lpMsgBuf );
 			} // if (CreateProcess(tortoiseProcPath, const_cast<TCHAR*>(svnCmd.c_str()), NULL, NULL, FALSE, 0, 0, 0, &startup, &process)==0) 
+			CloseHandle(process.hThread);
+			CloseHandle(process.hProcess);
 			hr = NOERROR;
 		} // if (myIDMap.find(idCmd) != myIDMap.end()) 
 	} // if ((files_.size() > 0)||(folder_.size() > 0)) 
Index: src/TortoiseShell/RemoteCacheLink.cpp
===================================================================
--- src/TortoiseShell/RemoteCacheLink.cpp	(revision 5085)
+++ src/TortoiseShell/RemoteCacheLink.cpp	(working copy)
@@ -131,6 +131,8 @@
 			ATLTRACE("Failed to start cache\n");
 			return false;
 		}
+		CloseHandle(process.hThread);
+		CloseHandle(process.hProcess);
 		sCachePath.ReleaseBuffer();
 
 		// Wait for the cache to open


