summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep')
-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 49f6d89c..db92ea8e 100644
--- a/sysdep/unix/wg_user.c
+++ b/sysdep/unix/wg_user.c
@@ -54,9 +54,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
@@ -222,7 +220,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);
@@ -235,7 +236,7 @@ wg_user_set_device(struct pool *pool,
if (len < 0)
{
- /* FIXME close */
+ rfree(sock);
return -1;
}
res = sk_send(sock, tbsize - size);