diff --git a/portfwd.c b/portfwd.c index 8e5f087c..2f3ee6e5 100644 --- a/portfwd.c +++ b/portfwd.c @@ -1129,8 +1129,9 @@ struct portfwdmgr_connect_ctx { static Socket *portfwdmgr_connect_helper(void *vctx, Plug *plug) { struct portfwdmgr_connect_ctx *ctx = (struct portfwdmgr_connect_ctx *)vctx; - return new_connection(ctx->addr, ctx->canonical_hostname, ctx->port, - false, true, false, false, plug, ctx->conf); + return new_connection(sk_addr_dup(ctx->addr), ctx->canonical_hostname, + ctx->port, false, true, false, false, plug, + ctx->conf); } /* diff --git a/unix/uxagentc.c b/unix/uxagentc.c index b937e7e4..cc6063fd 100644 --- a/unix/uxagentc.c +++ b/unix/uxagentc.c @@ -137,7 +137,7 @@ struct agent_connect_ctx { Socket *agent_connect(void *vctx, Plug *plug) { agent_connect_ctx *ctx = (agent_connect_ctx *)vctx; - return sk_new(ctx->addr, 0, false, false, false, false, plug); + return sk_new(sk_addr_dup(ctx->addr), 0, false, false, false, false, plug); } agent_connect_ctx *agent_get_connect_ctx(void)