File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -2124,6 +2124,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
21242124
21252125 if (is_dlopen_error) {
21262126 Local<String> errmsg = OneByteString (env->isolate (), uv_dlerror (&lib));
2127+ uv_dlclose (&lib);
21272128#ifdef _WIN32
21282129 // Windows needs to add the filename into the error message
21292130 errmsg = String::Concat (errmsg, args[1 ]->ToString (env->isolate ()));
@@ -2133,10 +2134,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
21332134 }
21342135
21352136 if (mp == nullptr ) {
2137+ uv_dlclose (&lib);
21362138 env->ThrowError (" Module did not self-register." );
21372139 return ;
21382140 }
21392141 if (mp->nm_version != NODE_MODULE_VERSION) {
2142+ uv_dlclose (&lib);
21402143 char errmsg[1024 ];
21412144 snprintf (errmsg,
21422145 sizeof (errmsg),
@@ -2146,6 +2149,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
21462149 return ;
21472150 }
21482151 if (mp->nm_flags & NM_F_BUILTIN) {
2152+ uv_dlclose (&lib);
21492153 env->ThrowError (" Built-in module self-registered." );
21502154 return ;
21512155 }
@@ -2162,6 +2166,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
21622166 } else if (mp->nm_register_func != nullptr ) {
21632167 mp->nm_register_func (exports, module , mp->nm_priv );
21642168 } else {
2169+ uv_dlclose (&lib);
21652170 env->ThrowError (" Module has no declared entry point." );
21662171 return ;
21672172 }
You can’t perform that action at this time.
0 commit comments