Skip to content

Commit

Permalink
Fix CoTaskMemFree always getting called with null
Browse files Browse the repository at this point in the history
  • Loading branch information
AmionSky committed Jan 22, 2023
1 parent 96e1fbf commit 72ad936
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/host/wasapi/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 _));
}
}
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 72ad936

Please sign in to comment.