From 6d5919ea8fe4f2794a1fe6ffff26dd0ad56faff6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Sat, 23 Jan 2016 13:33:10 +0100 Subject: [PATCH 1/1] afm-main-plugin: fix fatal error on initialisation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The code was asking to disconnect from dbus even if not connected. The library dbus aborts the program in that case. Ouch... That is now taken into account and don't fail more. Change-Id: I088ef547f6a415e0adb795ac2e64233fd45dc945 Signed-off-by: José Bollo --- plugins/afm-main-plugin/utils-jbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/afm-main-plugin/utils-jbus.c b/plugins/afm-main-plugin/utils-jbus.c index d58def90..201b0a6f 100644 --- a/plugins/afm-main-plugin/utils-jbus.c +++ b/plugins/afm-main-plugin/utils-jbus.c @@ -391,7 +391,6 @@ struct jbus *create_jbus(int session, const char *path) } jbus->refcount = 1; jbus->path = strdup(path); - jbus->name = NULL; if (jbus->path == NULL) { errno = ENOMEM; goto error2; @@ -441,7 +440,8 @@ void jbus_unref(struct jbus *jbus) { struct jservice *srv; if (!--jbus->refcount) { - dbus_connection_unref(jbus->connection); + if (jbus->connection != NULL) + dbus_connection_unref(jbus->connection); while((srv = jbus->services) != NULL) { jbus->services = srv->next; free(srv->method); -- 2.16.6