CoreTemp: Fixed mutex handle leak.

This commit is contained in:
spx 2011-02-19 11:12:06 +00:00
parent a2316446ca
commit 6c36a662e5

View File

@ -32,15 +32,17 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData)
if (hdlMemory == NULL) if (hdlMemory == NULL)
{ {
ReleaseMutex(hdlMutex); ReleaseMutex(hdlMutex);
CloseHandle(hdlMutex);
return false; return false;
} }
pSharedData = (PCORE_TEMP_SHARED_DATA)MapViewOfFile(hdlMemory, FILE_MAP_READ, 0, 0, 0); pSharedData = (PCORE_TEMP_SHARED_DATA)MapViewOfFile(hdlMemory, FILE_MAP_READ, 0, 0, 0);
if (pSharedData == NULL) if (pSharedData == NULL)
{ {
ReleaseMutex(hdlMutex);
CloseHandle(hdlMemory); CloseHandle(hdlMemory);
hdlMemory = NULL; hdlMemory = NULL;
ReleaseMutex(hdlMutex);
CloseHandle(hdlMutex);
return false; return false;
} }
@ -58,6 +60,7 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData)
UnmapViewOfFile(pSharedData); UnmapViewOfFile(pSharedData);
CloseHandle(hdlMemory); CloseHandle(hdlMemory);
ReleaseMutex(hdlMutex); ReleaseMutex(hdlMutex);
CloseHandle(hdlMutex);
return bRet; return bRet;
} }