Skip to content
New issue

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

A Potential memory leak bug. #28

Open
y1lan opened this issue Apr 27, 2024 · 0 comments
Open

A Potential memory leak bug. #28

y1lan opened this issue Apr 27, 2024 · 0 comments

Comments

@y1lan
Copy link

y1lan commented Apr 27, 2024

I have identified a potential memory leak bug in the following code snippet from the repository:

pub fn new() -> Result<Self> {
        unsafe {
            let ctx_config = bindings::futhark_context_config_new();
            let ctx = bindings::futhark_context_new(ctx_config);

            let err = bindings::futhark_context_get_error(ctx);

            if err.is_null() {
                Ok(FutharkContext {
                    context: ctx,
                    config: ctx_config,
                })
            } else {
                Err(FutharkError::_new(err).into())
            }
        }
    }

My question is whether, when the variable err is null, the variables ctx_config and ctx might leak. I would greatly appreciate it if developers could help me verify this issue.

Thank you for your assistance, and I apologize for any inconvenience caused by my limited understanding of the entire C program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant