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

Fix double-free on FreeBSD #58085

Merged
merged 2 commits into from
Aug 25, 2021
Merged

Fix double-free on FreeBSD #58085

merged 2 commits into from
Aug 25, 2021

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Aug 25, 2021

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

}
finally
{
Marshal.FreeHGlobal((IntPtr)pBuffer);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is fixing the double-free.

}
finally
{
NativeMemory.Free(processInfo);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is fixing a related memory leak.

@@ -65,7 +65,7 @@ internal static unsafe int[] ListAllPids()
}
finally
{
Marshal.FreeHGlobal((IntPtr)entries);
NativeMemory.Free(entries);
Copy link
Member Author

Choose a reason for hiding this comment

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

Took this as an opportunity to switch to NativeMemory API and avoid the casts in these files.

@ghost
Copy link

ghost commented Aug 25, 2021

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #14537 (comment)

Author: jkotas
Assignees: -
Labels:

area-System.Diagnostics.Process

Milestone: -

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM

@wfurt wfurt added the os-freebsd FreeBSD OS label Aug 25, 2021
@Thefrank
Copy link
Contributor

ooooh! So, this fixes the segfault that started to crop up after some SDK changes around preview 3?

Also, will this get back ported to 6.0?

@jkotas jkotas merged commit 3633a7d into dotnet:main Aug 25, 2021
@jkotas jkotas deleted the freebsd-fix branch August 25, 2021 06:04
@jkotas
Copy link
Member Author

jkotas commented Aug 25, 2021

So, this fixes the segfault that started to crop up after some SDK changes around preview 3?

Probably. That something you can verify. I have not verified it.

Also, will this get back ported to 6.0?

@danmoseley Are you willing to take this for 6.0? This is a fix for double-free bug in FreeBSD specific code, not touching officially supported configs.

@adamsitnik adamsitnik added this to the 7.0.0 milestone Aug 25, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for FreeBSD
4 participants