mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
os: fix GetInterfaceAddresses memory lieaky
PR-URL: https://github.com/nodejs/node/pull/58940 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
parent
f5da8f89ee
commit
b890c51ff2
|
|
@ -214,6 +214,9 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
|
|||
return;
|
||||
}
|
||||
|
||||
auto cleanup =
|
||||
OnScopeLeave([&]() { uv_free_interface_addresses(interfaces, count); });
|
||||
|
||||
Local<Value> no_scope_id = Integer::New(isolate, -1);
|
||||
LocalVector<Value> result(isolate);
|
||||
result.reserve(count * 7);
|
||||
|
|
@ -268,7 +271,6 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
|
|||
}
|
||||
}
|
||||
|
||||
uv_free_interface_addresses(interfaces, count);
|
||||
args.GetReturnValue().Set(Array::New(isolate, result.data(), result.size()));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user