forked from quic-go/quic-go
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:
@@ -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)
|
conn, err := tr.dial(ctx, udpAddr, addr, tlsConf, conf, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
tr.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return conn, nil
|
return conn, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user