Skip to content

Allocation is leaked when jack_activate fails #232

@SludgePhD

Description

@SludgePhD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions