-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix double-free on FreeBSD #58085
Conversation
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue DetailsFixes #14537 (comment)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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? |
Probably. That something you can verify. I have not verified it.
@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. |
Fixes #14537 (comment)