]> git.feebdaed.xyz Git - 0xmirror/quic-go.git/commitdiff
close Transport when DialAddr fails (#5259)
authorCoia Prant <coiaprant@gmail.com>
Sat, 12 Jul 2025 16:58:30 +0000 (00:58 +0800)
committerGitHub <noreply@github.com>
Sat, 12 Jul 2025 16:58:30 +0000 (18:58 +0200)
Close the transport after dial fails to avoid memory leaks. Same logic as DialAddrEarly.

Signed-off-by: Coia Prant <coiaprant@gmail.com>
client.go

index 5386e5980365f5c840b4d8ba8a4cfb9596e12b9d..63132f2deb1d5e56ce3deb0c62f9478f644196ee 100644 (file)
--- a/client.go
+++ b/client.go
@@ -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