-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix COM object leak #89745
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 COM object leak #89745
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 Issue DetailsFix a case where we accidentally leaked a COM object reference in System.DirectoryServices.AccountManagement. I validated that there's no other cases where we missed a leak in the rest of the codebase. The rest of the cases where we use COM interop either didn't have this issue or get their COM object references through COM Activation, so they don't go through LibraryImport at all. Fixes #83269
|
| { | ||
| if (ppObjPtr != IntPtr.Zero) | ||
| { | ||
| Marshal.Release(ppObjPtr); |
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.
Is it possible to add a unit test for this?
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.
I don't know enough about this space to add a unit test and testing specifically if we leak a COM object here is difficult.
buyaa-n
left a 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, it would be great if we could add a unit test. Also, I believe we want to port it into 7.0
|
/backport to release/7.0-staging |
|
Started backporting to release/7.0-staging: https://github.com/dotnet/runtime/actions/runs/5729686954 |
Fix a case where we accidentally leaked a COM object reference in System.DirectoryServices.AccountManagement.
I validated that there's no other cases where we missed a leak in the rest of the codebase. The rest of the cases where we use COM interop either didn't have this issue or get their COM object references through COM Activation, so they don't go through LibraryImport at all.
Fixes #83269