From 899b0ccad5d4bfeaad70293690f45273274c75e9 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 13 May 2020 17:37:07 +0200 Subject: close socket fixing leak --- sysdep/unix/wg_user.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sysdep') diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c index 8c8f9dc4..1446d20b 100644 --- a/sysdep/unix/wg_user.c +++ b/sysdep/unix/wg_user.c @@ -262,6 +262,9 @@ wg_user_set_device(struct pool *pool, res = sk_send(sock, tbsize - size); /* Send data, <0=err, >0=ok, 0=sleep */ DBG(L_TRACE "WG: send %d", res); + if (res != 0) { + rfree(sock); + } /* abort(); */ return -1; -- cgit v1.2.3