summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/telepathy-logger.c13
-rw-r--r--telepathy-logger/observer.c3
2 files changed, 11 insertions, 5 deletions
diff --git a/src/telepathy-logger.c b/src/telepathy-logger.c
index 988b0be..5d5cbed 100644
--- a/src/telepathy-logger.c
+++ b/src/telepathy-logger.c
@@ -90,6 +90,7 @@ log_handler (const gchar *log_domain,
}
#endif /* ENABLE_DEBUG */
+
static TplDBusService *
telepathy_logger_dbus_init (void)
{
@@ -123,8 +124,9 @@ telepathy_logger_dbus_init (void)
out:
if (error != NULL)
- g_error_free (error);
- g_object_unref (tp_bus);
+ g_clear_error (&error);
+ if (tp_bus != NULL)
+ g_object_unref (tp_bus);
return dbus_srv;
}
@@ -186,8 +188,11 @@ main (int argc,
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
- g_object_unref (observer);
- g_object_unref (dbus_srv);
+out:
+ if (observer != NULL)
+ g_object_unref (observer);
+ if (dbus_srv != NULL)
+ g_object_unref (dbus_srv);
tpl_channel_factory_deinit ();
#ifdef ENABLE_DEBUG
diff --git a/telepathy-logger/observer.c b/telepathy-logger/observer.c
index 43ef089..fd05ef4 100644
--- a/telepathy-logger/observer.c
+++ b/telepathy-logger/observer.c
@@ -465,7 +465,8 @@ tpl_observer_register_dbus (TplObserver *self,
tp_proxy_get_dbus_connection (TP_PROXY (tp_bus)),
TPL_OBSERVER_OBJECT_PATH, G_OBJECT (self));
out:
- g_object_unref (tp_bus);
+ if (tp_bus != NULL)
+ g_object_unref (tp_bus);
return ret;
}