summaryrefslogtreecommitdiff
path: root/sysdep/unix/wg_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep/unix/wg_user.c')
-rw-r--r--sysdep/unix/wg_user.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c
index 4668b2c6..5f5428bf 100644
--- a/sysdep/unix/wg_user.c
+++ b/sysdep/unix/wg_user.c
@@ -55,9 +55,7 @@ void user_err_hook(struct birdsock *bs, int err)
/* return; */
log(L_TRACE "WG: ERR %p %d %s", bs, err, bs->err);
- if (bs->fd >= 0)
- close(bs->fd);
- bs->fd = -1;
+ rfree(bs);
}
static void
@@ -223,7 +221,10 @@ wg_user_set_device(struct pool *pool,
int res = sk_connect_unix(sock, path);
DBG(L_TRACE "WG: socket %d %d %s", res, sock->fd, path);
if (res < 0)
- return -1;
+ {
+ rfree(sock);
+ return -1;
+ }
uint tbsize = 8192;
sk_set_tbsize(sock, tbsize);
@@ -236,7 +237,7 @@ wg_user_set_device(struct pool *pool,
if (len < 0)
{
- /* FIXME close */
+ rfree(sock);
return -1;
}
res = sk_send(sock, tbsize - size);