mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix undefined behavior in energymon::init
This commit is contained in:
parent
d186ab6927
commit
3160e62b8a
1 changed files with 1 additions and 2 deletions
|
@ -29,7 +29,6 @@ mod energymon {
|
|||
|
||||
use self::energy_monitor::EnergyMonitor;
|
||||
use self::energymon::EnergyMon;
|
||||
use std::mem;
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
static mut EM: Option<*mut EnergyMon> = None;
|
||||
|
@ -41,7 +40,7 @@ mod energymon {
|
|||
if let Ok(em) = EnergyMon::new() {
|
||||
println!("Started energy monitoring from: {}", em.source());
|
||||
unsafe {
|
||||
EM = Some(mem::transmute(Box::new(em)));
|
||||
EM = Some(Box::into_raw(Box::new(em)));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue