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

Win32 handle leak fix #11842

Merged
merged 3 commits into from
Feb 25, 2019
Merged

Win32 handle leak fix #11842

merged 3 commits into from
Feb 25, 2019

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Feb 25, 2019

Fixes #11841 and likely fixes #11698.

Additionally, minor code cleanups.

@hrydgard hrydgard added this to the v1.8.0 milestone Feb 25, 2019
@hrydgard hrydgard merged commit 64dd425 into master Feb 25, 2019
@hrydgard hrydgard deleted the win32-handle-leak-fix branch February 25, 2019 20:49
@@ -133,6 +133,7 @@ std::string ResolvePath(const std::string &path) {
int result = getFinalPathNameByHandleW(hFile, buf, BUF_SIZE - 1, FILE_NAME_NORMALIZED | VOLUME_NAME_DOS);
if (result >= BUF_SIZE || result == 0)
wcscpy_s(buf, BUF_SIZE - 1, input.c_str());
CloseHandle(hFile);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg, oops. Thanks.

-[Unknown]

if (filePath_.empty()) {
// Happens when workqueue tries to figure out priorities in PrioritizedWorkQueue::Pop(),
// because priority() calls GetFileLoader()... gnarly.
return fileLoader;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remember that for some loaders, e.g. ones that involve memory caching or http access, the cost of tossing this in the bin and getting a new one a couple times is much higher. Ideally we shouldn't recreate just because that's easiest.

-[Unknown]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, put this comment in the wrong place somehow - was meant for the lifetime comment.

-[Unknown]

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

Successfully merging this pull request may close these issues.

Handle leak on Windows Can't download any file
2 participants