zeroconf/Avahi: move dbus_shutdown() call to the end of Main()

Calling dbus_shutdown() too early will break the "udisks2" neighbor
plugin.
This commit is contained in:
Max Kellermann
2018-06-03 10:37:54 +02:00
parent 32064a23c1
commit adf2d3aff2
3 changed files with 13 additions and 4 deletions

View File

@@ -101,6 +101,10 @@
#include <systemd/sd-daemon.h>
#endif
#ifdef ENABLE_DBUS
#include <dbus/dbus.h>
#endif
#include <stdlib.h>
#ifdef HAVE_LOCALE_H
@@ -713,6 +717,12 @@ try {
IcuFinish();
log_deinit();
#ifdef ENABLE_DBUS
/* free libdbus memory to make memory leak checkers happy */
dbus_shutdown();
#endif
return EXIT_SUCCESS;
} catch (const std::exception &e) {
LogError(e);

View File

@@ -34,8 +34,6 @@
#include <avahi-common/malloc.h>
#include <avahi-common/error.h>
#include <dbus/dbus.h>
static constexpr Domain avahi_domain("avahi");
static char *avahi_name;
@@ -277,6 +275,4 @@ AvahiDeinit()
avahi_free(avahi_name);
avahi_name = nullptr;
dbus_shutdown();
}