Free the raw sockets when the loopback lookup fails

This commit is contained in:
Viktor Liu
2026-08-25 19:09:32 +02:00
parent afd048331b
commit faed37fe8c

View File

@@ -76,6 +76,9 @@ func (p *Proxy) Listen() error {
loopback, err := net.InterfaceByName(loopbackDevice)
if err != nil {
if freeErr := p.Free(); freeErr != nil {
log.Errorf("failed to free the wgproxy: %s", freeErr)
}
return fmt.Errorf("look up %s: %w", loopbackDevice, err)
}
p.loIndex = loopback.Index