-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
objectwrap: avoid double-free on old Node.js
On Node.js versions earlier than 10.15.3 references were being cleaned up differently. This has resulted in a segfault because of a double free when the `ObjectWrap<T>` subclass constructor throws. We need a fix that only runs on Node.js < 10.15.3. We use `Napi::VersionManagement::GetNodeVersion()` at addon load time to determine whether we need the workaround. We store the result in an atomic boolean and consult its value whenever we destroy an `ObjectWrap<T>` instance.
- Loading branch information
Gabriel Schulhof
committed
Jun 12, 2020
1 parent
81e2eac
commit 470f130
Showing
2 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters