free dbus errors when inhibiting freedesktop screensaver (prevents small memory leak)

This commit is contained in:
Mark Riedesel 2021-10-12 21:11:56 -04:00
parent 6f1d2133bb
commit f0dd693a08
1 changed files with 4 additions and 0 deletions

View File

@ -50,6 +50,7 @@ void FreeDesktopScreenSaver::inhibit() {
DBusConnection *bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
unsupported = true;
return;
}
@ -72,6 +73,7 @@ void FreeDesktopScreenSaver::inhibit() {
DBusMessage *reply = dbus_connection_send_with_reply_and_block(bus, message, 50, &error);
dbus_message_unref(message);
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_connection_unref(bus);
unsupported = false;
return;
@ -96,6 +98,7 @@ void FreeDesktopScreenSaver::uninhibit() {
DBusConnection *bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
unsupported = true;
return;
}
@ -110,6 +113,7 @@ void FreeDesktopScreenSaver::uninhibit() {
DBusMessage *reply = dbus_connection_send_with_reply_and_block(bus, message, 50, &error);
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_connection_unref(bus);
unsupported = true;
return;