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

Handle leak inside psutil_get_process_data #870

Closed
xBeAsTx opened this Issue Aug 10, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@xBeAsTx
Contributor

xBeAsTx commented Aug 10, 2016

https://github.com/giampaolo/psutil/blob/master/psutil/arch/windows/process_info.c#L436
Here is open process:

hProcess = psutil_handle_from_pid(pid);

and if all actions was succesful process handle not closing https://github.com/giampaolo/psutil/blob/master/psutil/arch/windows/process_info.c#L668

    *pdata = buffer;
    *psize = size;

    return 0;

error:
    if (hProcess != NULL)
        CloseHandle(hProcess);
    if (buffer != NULL)
        free(buffer);
    return -1;
}

Only if errors occured.

xBeAsTx added a commit to xBeAsTx/psutil that referenced this issue Aug 10, 2016

@giampaolo

This comment has been minimized.

Owner

giampaolo commented Aug 10, 2016

Good catch. Up for making a PR? =)

giampaolo added a commit that referenced this issue Aug 10, 2016

@giampaolo

This comment has been minimized.

Owner

giampaolo commented Aug 10, 2016

Fixed in #871.

@giampaolo giampaolo closed this Aug 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment