Fix use-after-free in SNI

gtk_icon_theme_load_icon returns a pixbuf which is not owned by us, and
therefore g_free shouldn't be called. When reloading an icon, this pixbuf
was reused by the icon theme even though we just free'd it.

Fixes: https://github.com/scorpion-26/gBar/issues/74
This commit is contained in:
scorpion-26 2023-12-14 23:54:07 +01:00
parent 0e8634a227
commit 438024c626

View file

@ -279,7 +279,7 @@ namespace SNI
LOG("SNI: " << name << " vanished!");
g_bus_unwatch_name(it->watcherID);
g_dbus_connection_signal_unsubscribe(dbusConnection, it->propertyChangeWatcherID);
g_free(it->pixbuf);
g_object_unref(it->pixbuf);
items.erase(it);
InvalidateWidget();
return;
@ -337,7 +337,7 @@ namespace SNI
{
g_bus_unwatch_name(it->watcherID);
g_dbus_connection_signal_unsubscribe(dbusConnection, it->propertyChangeWatcherID);
g_free(it->pixbuf);
g_object_unref(it->pixbuf);
items.erase(it);
}
else