[Dnsmasq-discuss] [PATCH 1/1] Fixed resource leak on ubus_init failure.

Oldřich Jedlička oldium.pro at gmail.com
Wed Mar 18 21:24:55 GMT 2020


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 <oldium.pro at gmail.com>
---
 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;
     }
 
-- 
2.17.1




More information about the Dnsmasq-discuss mailing list