CrystalDiskInfo
CrystalDiskInfo copied to clipboard
Fix resource leaks
I have found two places in the code where resources are not released correctly.
It is possible to revert the deletion of SAFE_RELEASE(pCOMDev); from line 64 if you believe VariantInit, VariantClear or IWbemClassObject::Get could throw an exception that would skip over line 56.
EDIT: I have found two more places where resources can be leaked.
The error handling logic is already quite messy, and all this leaking issue can be trivially fixed by simply replacing all the raw COM pointers with a smart pointer ComPtr (or better use wil that also provides HRESULT error checking). @hiyohiyo What do you think?