Skip to content

Commit

Permalink
bugfix: close IPv4 socket if opening IPv6 connection creates an error
Browse files Browse the repository at this point in the history
  • Loading branch information
dmke committed Feb 23, 2018
1 parent 9bcace4 commit bc6d8f3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func New(bind4, bind6 string) (*Pinger, error) {

conn6, err := connectICMP("ip6:ipv6-icmp", bind6)
if err != nil {
if conn4 != nil {
conn4.Close()
}
return nil, err
}

Expand Down

0 comments on commit bc6d8f3

Please sign in to comment.