]> git.ipfire.org Git - thirdparty/wireguard-go.git/commit
tun: avoid leaking sock fd in CreateTUN error cases
authorTobias Klauser <tklauser@distanz.ch>
Thu, 23 Sep 2021 10:05:13 +0000 (12:05 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 23 Sep 2021 15:53:49 +0000 (09:53 -0600)
commiteae5e0f3a3a5b08a843756093dc3bfd0f4068108
treeaa4fc9d7f91740685eb8b99e4a942ba75e407ca0
parent2ef39d47540c4537f0ddd3355fb95b33b91c09b7
tun: avoid leaking sock fd in CreateTUN error cases

At these points, the socket file descriptor is not yet wrapped in an
*os.File, so it needs to be closed explicitly on error.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
tun/tun_darwin.go
tun/tun_linux.go