zeroconf-publish: fix unitialized DBusError
authorTanu Kaskinen <tanuk@iki.fi>
Thu, 12 Jan 2017 04:45:20 +0000 (06:45 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Thu, 12 Jan 2017 12:10:13 +0000 (14:10 +0200)
BugLink: https://bugs.archlinux.org/task/52484
src/modules/module-zeroconf-publish.c

index e971029..482881c 100644 (file)
@@ -679,8 +679,11 @@ static char *get_icon_name(pa_module*m) {
     DBusConnection *conn = NULL;
     DBusMessageIter sub;
 
+    dbus_error_init(&error);
+
     if (!(bus = pa_dbus_bus_get(m->core, DBUS_BUS_SYSTEM, &error))) {
         pa_log("Failed to get system bus connection: %s", error.message);
+        dbus_error_free(&error);
         goto out;
     }
 
@@ -692,7 +695,6 @@ static char *get_icon_name(pa_module*m) {
                                        "Get");
     dbus_message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID);
 
-    dbus_error_init(&error);
     if ((reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &error)) == NULL) {
         pa_log("Failed to send: %s:%s", error.name, error.message);
         dbus_error_free(&error);