summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2022-02-24 23:18:54 +0000
committerSimon Kelley <simon@thekelleys.org.uk>2022-02-24 23:18:54 +0000
commitc27cfeaa7b9bfa09b347f3f26390af39177190db (patch)
treeffd10bf8660be3fbc79e7b6ef4519ff69ab618e7
parentbb6f6bae0ba6a95f481485f9d74a89072f2c800c (diff)
downloaddnsmasq-c27cfeaa7b9bfa09b347f3f26390af39177190db.tar.gz
Fix memory leak when DBUS connection fails.
-rw-r--r--src/dbus.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dbus.c b/src/dbus.c
index 0c55ea5..bf6b661 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -761,8 +761,11 @@ char *dbus_init(void)
dbus_error_init (&dbus_error);
if (!(connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error)))
- return NULL;
-
+ {
+ dbus_error_free(&dbus_error);
+ return NULL;
+ }
+
dbus_connection_set_exit_on_disconnect(connection, FALSE);
dbus_connection_set_watch_functions(connection, add_watch, remove_watch,
NULL, NULL, NULL);