diff --git a/Makefile.am b/Makefile.am index c29845938..ca20ddf69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,7 @@ src_mpd_LDADD = \ $(STORAGE_LIBS) \ $(PLAYLIST_LIBS) \ $(AVAHI_LIBS) \ + $(DBUS_LIBS) \ $(LIBWRAP_LDFLAGS) \ $(SQLITE_LIBS) \ $(DECODER_LIBS) \ @@ -67,6 +68,8 @@ src_mpd_LDADD = \ libutil.a \ $(SYSTEMD_DAEMON_LIBS) +src_mpd_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) + src_mpd_SOURCES = \ src/Main.cxx src/Main.hxx diff --git a/src/Main.cxx b/src/Main.cxx index 19b18f7a4..461272263 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -101,6 +101,10 @@ #include #endif +#ifdef ENABLE_DBUS +#include +#endif + #include #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); diff --git a/src/zeroconf/ZeroconfAvahi.cxx b/src/zeroconf/ZeroconfAvahi.cxx index f6caa7884..a559a7b08 100644 --- a/src/zeroconf/ZeroconfAvahi.cxx +++ b/src/zeroconf/ZeroconfAvahi.cxx @@ -34,8 +34,6 @@ #include #include -#include - static constexpr Domain avahi_domain("avahi"); static char *avahi_name; @@ -277,6 +275,4 @@ AvahiDeinit() avahi_free(avahi_name); avahi_name = nullptr; - - dbus_shutdown(); }