Avoid needless reallocation of host & port strings on iOS

This is also extremely likely a memory leak since we're never cleaning
these up - best to avoid that!
This commit is contained in:
Tim Perry
2024-06-12 12:40:36 +02:00
parent b0387881c9
commit b96aac3d0a
+3 -3
View File
@@ -29,11 +29,11 @@ const nw_endpoint_create_host = new NativeFunction(
'pointer', ['pointer', 'pointer']
);
const newHostStr = Memory.allocUtf8String(PROXY_HOST);
const newPortStr = Memory.allocUtf8String(PROXY_PORT.toString());
Interceptor.attach(nw_connection_create, {
onEnter: function (args) {
const newHostStr = Memory.allocUtf8String(PROXY_HOST);
const newPortStr = Memory.allocUtf8String(PROXY_PORT.toString());
// Replace the endpoint argument entirely with our own:
args[0] = nw_endpoint_create_host(newHostStr, newPortStr);
}