Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resource leaks #243

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions AtaSmart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ VOID CAtaSmart::Init(BOOL useWmi, BOOL advancedDiskSearch, PBOOL flagChangeDisk,

SAFE_RELEASE(pCOMDev);
}
SAFE_RELEASE(pEnumCOMDevs);
}
catch (...)
{
Expand Down Expand Up @@ -1953,15 +1954,15 @@ VOID CAtaSmart::Init(BOOL useWmi, BOOL advancedDiskSearch, PBOOL flagChangeDisk,
DebugPrint(_T("EX:Drive Letter Mapping"));
}
*/
safeRelease:
}
safeRelease:

SAFE_RELEASE(pCOMDev);
SAFE_RELEASE(pEnumCOMDevs);
SAFE_RELEASE(pEnumCOMDevs2);
SAFE_RELEASE(pIWbemServices);
SAFE_RELEASE(pCOMDev);
SAFE_RELEASE(pEnumCOMDevs);
SAFE_RELEASE(pEnumCOMDevs2);
SAFE_RELEASE(pIWbemServices);
// CoUninitialize();
// DebugPrint(_T("OK:CoUninitialize()"));
}
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion SlotSpeedGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CString GetStringValueFromQuery(IWbemServices* pIWbemServices, const CString que
VariantClear(&pVal);
}
VariantInit(&pVal);
SAFE_RELEASE(pCOMDev);
}
}
}
Expand All @@ -61,7 +62,6 @@ CString GetStringValueFromQuery(IWbemServices* pIWbemServices, const CString que
result = L"";
}

SAFE_RELEASE(pCOMDev);
SAFE_RELEASE(pEnumCOMDevs);
return result;
}
Expand Down Expand Up @@ -177,6 +177,7 @@ SlotMaxCurrSpeed GetSlotMaxCurrSpeedFromDeviceID(const CString DeviceID)

++CurrentDevice;
} while (LastResult);
SetupDiDestroyDeviceInfoList(ClassDeviceInformations);

return ConvertOSResult(OSLevelResult);
}
Expand Down