Browse Source

Fixed handle leak in BfpProcess_GetById

Brian Fiete 11 tháng trước cách đây
mục cha
commit
ff2affb733

+ 1 - 0
BeefTools/BeefCon/src/Program.bf

@@ -163,6 +163,7 @@ class Program
 		while (true)
 		while (true)
 		{
 		{
 			// Check BeefIDE process
 			// Check BeefIDE process
+			if ((mPid != 123) || (!Debug.IsDebuggerPresent))
 			{
 			{
 				var process = Platform.BfpProcess_GetById(null, mPid, null);
 				var process = Platform.BfpProcess_GetById(null, mPid, null);
 				if (process == null)
 				if (process == null)

+ 1 - 0
BeefySysLib/platform/win/Platform.cpp

@@ -1301,6 +1301,7 @@ BFP_EXPORT BfpProcess* BFP_CALLTYPE BfpProcess_GetById(const char* machineName,
 		OUTRESULT(BfpProcessResult_NotFound);
 		OUTRESULT(BfpProcessResult_NotFound);
 		return NULL;
 		return NULL;
 	}	
 	}	
+	::CloseHandle(hProc);
 
 
 	BfpProcess* process = new BfpProcess();
 	BfpProcess* process = new BfpProcess();
 	process->mProcessId = processId;
 	process->mProcessId = processId;