mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
fix(proxy): maybe memory leak on failed NAT check
Maybe related: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40243
This commit is contained in:
parent
f44aa279fe
commit
51edbbfd26
1 changed files with 5 additions and 3 deletions
|
@ -817,6 +817,11 @@ func (sf *SnowflakeProxy) checkNATType(config webrtc.Configuration, probeURL str
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making WebRTC connection: %w", err)
|
return fmt.Errorf("Error making WebRTC connection: %w", err)
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err := pc.Close(); err != nil {
|
||||||
|
log.Printf("Probetest: error calling pc.Close: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
offer := pc.LocalDescription()
|
offer := pc.LocalDescription()
|
||||||
log.Printf("Probetest offer: \n\t%s", strings.ReplaceAll(offer.SDP, "\n", "\n\t"))
|
log.Printf("Probetest offer: \n\t%s", strings.ReplaceAll(offer.SDP, "\n", "\n\t"))
|
||||||
|
@ -874,8 +879,5 @@ func (sf *SnowflakeProxy) checkNATType(config webrtc.Configuration, probeURL str
|
||||||
|
|
||||||
log.Printf("NAT Type measurement: %v -> %v\n", prevNATType, getCurrentNATType())
|
log.Printf("NAT Type measurement: %v -> %v\n", prevNATType, getCurrentNATType())
|
||||||
|
|
||||||
if err := pc.Close(); err != nil {
|
|
||||||
log.Printf("error calling pc.Close: %v", err)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue