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

Handle leak inside psutil_get_process_data #870

Closed
xbeastx opened this issue Aug 10, 2016 · 2 comments
Closed

Handle leak inside psutil_get_process_data #870

xbeastx opened this issue Aug 10, 2016 · 2 comments

Comments

@xbeastx
Copy link
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 pushed a commit to xbeastx/psutil that referenced this issue Aug 10, 2016
@giampaolo
Copy link
Owner

Good catch. Up for making a PR? =)

giampaolo added a commit that referenced this issue Aug 10, 2016
@giampaolo
Copy link
Owner

Fixed in #871.

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

No branches or pull requests

2 participants