close Transport when DialAddr fails (#5259)

Close the transport after dial fails to avoid memory leaks. Same logic as DialAddrEarly.

Signed-off-by: Coia Prant <coiaprant@gmail.com>
This commit is contained in:
Coia Prant
2025-07-13 00:58:30 +08:00
committed by GitHub
parent 0a9c6ea4c8
commit afe01ef103

View File

@@ -31,6 +31,7 @@ func DialAddr(ctx context.Context, addr string, tlsConf *tls.Config, conf *Confi
}
conn, err := tr.dial(ctx, udpAddr, addr, tlsConf, conf, false)
if err != nil {
tr.Close()
return nil, err
}
return conn, nil