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: avoid contextBridge double free on garbage collection #21592
Conversation
@@ -76,11 +78,7 @@ WeakGlobalPairNode::WeakGlobalPairNode(WeakGlobalPair pair) { | |||
this->pair = std::move(pair); | |||
} | |||
|
|||
WeakGlobalPairNode::~WeakGlobalPairNode() { | |||
if (next) { |
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.
how... was this ever sensible?
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 think past me reasoned that deleting the head of a list should delete everything in the list without thinking about how this particular linked list was being used
Release Notes Persisted
|
I have automatically backported this PR to "8-x-y", please check out #21735 |
I have automatically backported this PR to "7-1-x", please check out #21736 |
Description of Change
Speculatively fix a crash in contextBridge. Because the elements in the hash-collided linked list are each subject to an object life monitor, they will free themselves. So it's redundant (and crash-y) to free next in the destructor.
Additionally, while we're at it, correct the pointer resetting of the linked list shuffling in the destructor.
Checklist
npm test
passesRelease Notes
Notes: Fixed a crash in contextBridge that happens on garbage collection