We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
nes-emulator/src/headless.rs
Line 117 in 0b9e321
https://doc.rust-lang.org/reference/behavior-considered-undefined.html : Dereferencing a null or dangling raw pointer.
Headless::joystick1/2 are initialized with:
impl Headless { fn command_load_rom(&mut self) { let mut record_tas = self.read_byte(); let filename = self.read_length_string(); let mut joystick1 = Box::new(Joystick::new()); let mut joystick2 = Box::new(Joystick::new()); self.joystick1 = &mut *joystick1; self.joystick2 = &mut *joystick2; ... // drop joystick1 joystick2 // Headless::joystick1/2 are dangling pointers since joystick1 joystick2 are freed }
The text was updated successfully, but these errors were encountered:
joystick1 and joystick2 aren't freed - their ownership is transferred to the Nes object created in the same function.
joystick1
joystick2
Nes
nes.rs even has this line:
nes.rs
nes-emulator/src/nes.rs
Line 156 in 0b9e321
because even though the second controller isn't used, its ownership needs to be transferred to prevent the exact problem you describe.
Sorry, something went wrong.
Right
No branches or pull requests
nes-emulator/src/headless.rs
Line 117 in 0b9e321
https://doc.rust-lang.org/reference/behavior-considered-undefined.html : Dereferencing a null or dangling raw pointer.
Headless::joystick1/2 are initialized with:
The text was updated successfully, but these errors were encountered: