From 741f912bc2b8da74ce7d60325dff662bdb4b2bfe Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 29 Apr 2016 11:39:34 +0200 Subject: iface: Close rtnl socket if address enumeration fails Fix a resource leak by closing the socket if iface_rtnl_enumerate() fails. Discovered by the Coverity scanner CID 99694. Signed-off-by: Tobias Klauser --- iface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iface.c b/iface.c index 4bc9b5e..9664a0c 100644 --- a/iface.c +++ b/iface.c @@ -355,9 +355,9 @@ int iface_run(void) /* send RTM_GETADDR request to initially populate the interface list */ if (iface_rtnl_enumerate(sock, RTM_GETADDR, AF_INET) < 0) - return -1; + goto out; if (iface_rtnl_enumerate(sock, RTM_GETADDR, AF_INET6) < 0) - return -1; + goto out; while (iface_running) { ssize_t recvlen; -- cgit v1.2.3-54-g00ecf