Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b73ff52

Browse filesBrowse files
indutnyrvagg
authored andcommitted
bindings: close after reading module struct
Do not let the module struct to be deallocated by `uv_dlclose` before reading data from it. PR-URL: #2792 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
1 parent 3ee7fbc commit b73ff52
Copy full SHA for b73ff52

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2120,12 +2120,15 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
21202120
return;
21212121
}
21222122
if (mp->nm_version != NODE_MODULE_VERSION) {
2123-
uv_dlclose(&lib);
21242123
char errmsg[1024];
21252124
snprintf(errmsg,
21262125
sizeof(errmsg),
21272126
"Module version mismatch. Expected %d, got %d.",
21282127
NODE_MODULE_VERSION, mp->nm_version);
2128+
2129+
// NOTE: `mp` is allocated inside of the shared library's memory, calling
2130+
// `uv_dlclose` will deallocate it
2131+
uv_dlclose(&lib);
21292132
env->ThrowError(errmsg);
21302133
return;
21312134
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.