Merge pull request #742 from AmionSky/fix-memfree

Fix CoTaskMemFree always getting called with null
This commit is contained in:
est31 2023-01-22 14:25:13 +01:00 • committed by GitHub
commit c67b4288f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,7 +134,7 @@ struct WaveFormatExPtr(*mut Audio::WAVEFORMATEX);
impl Drop for WaveFormatExPtr {
fn drop(&mut self) {
unsafe {
Com::CoTaskMemFree(None);
Com::CoTaskMemFree(Some(self.0 as *mut _));
}
}
}
@ -823,7 +823,7 @@ impl PartialEq for Device {
/// RAII for device IDs.
impl Drop for IdRAII {
fn drop(&mut self) {
unsafe { Com::CoTaskMemFree(None) }
unsafe { Com::CoTaskMemFree(Some(self.0 .0 as *mut _)) }
}
}
// GetId only fails with E_OUTOFMEMORY and if it does, we're probably dead already.