@@ -2087,12 +2087,15 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
2087 | 2087 | return; |
2088 | 2088 | } |
2089 | 2089 | if (mp->nm_version != NODE_MODULE_VERSION) { |
2090 | | -uv_dlclose(&lib); |
2091 | 2090 | char errmsg[1024]; |
2092 | 2091 | snprintf(errmsg, |
2093 | 2092 | sizeof(errmsg), |
2094 | 2093 | "Module version mismatch. Expected %d, got %d.", |
2095 | 2094 | NODE_MODULE_VERSION, mp->nm_version); |
| 2095 | + |
| 2096 | +// NOTE: `mp` is allocated inside of the shared library's memory, calling |
| 2097 | +// `uv_dlclose` will deallocate it |
| 2098 | +uv_dlclose(&lib); |
2096 | 2099 | env->ThrowError(errmsg); |
2097 | 2100 | return; |
2098 | 2101 | } |
|