From: José Bollo Date: Wed, 13 Jan 2016 16:35:57 +0000 (+0100) Subject: Fix a crash when connection to dbus fails X-Git-Tag: 2.0.2~96 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-main.git;a=commitdiff_plain;h=69a81bcc191be19e3bab2d5f0c8d3b1337a21ca0 Fix a crash when connection to dbus fails Change-Id: Ie3caca52b7b7f92cb4da4641d2884c7606444784 Signed-off-by: José Bollo --- diff --git a/src/utils-jbus.c b/src/utils-jbus.c index d58def9..201b0a6 100644 --- a/src/utils-jbus.c +++ b/src/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);