|
let mut callback_context = Box::new(CallbackContext { |
|
client, |
|
notification: notification_handler, |
|
process: process_handler, |
|
is_valid_for_callback: AtomicBool::new(true), |
|
has_panic: AtomicBool::new(false), |
|
}); |
|
CallbackContext::register_callbacks(&mut callback_context)?; |
|
let res = j::jack_activate(callback_context.client.raw()); |
|
match res { |
|
0 => Ok(AsyncClient { |
|
callback: Some(callback_context), |
|
}), |
|
_ => { |
|
mem::forget(callback_context); |
|
Err(Error::ClientActivationError) |
|
} |
|
} |
The mem::forget will leak the callbacks and the Box that was allocated earlier in the method.
rust-jack/src/client/async_client.rs
Lines 59 to 76 in 50adcd0
The
mem::forgetwill leak the callbacks and theBoxthat was allocated earlier in the method.