From 3f60ecd6f0a2241d0a881ec9de7e48f65683a06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= Date: Wed, 18 Mar 2020 22:24:55 +0100 Subject: [PATCH] Fixed resource leak on ubus_init failure. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When ubus_add_object fails, the ubus_connect object is not freed, so the connection leaks. Add ubus_destroy to free the connection object. Signed-off-by: Oldřich Jedlička --- src/ubus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ubus.c b/src/ubus.c index 79e2563..c7f6b19 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -102,6 +102,7 @@ void ubus_init() my_syslog(LOG_ERR, _("Cannot add object to UBus: %s"), ubus_strerror(ret)); error_logged = 1; } + ubus_destroy(ubus); return; }