From 73f64971c8118ee3d782edf657bbbb0ae90e29a9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 20 May 2024 08:57:28 -0400 Subject: [PATCH] css: Avoid a possible memory leak Currently, style->variables is always NULL when we get here, but better to be safe than sorry, and clear the fields before we overwrite it. --- gtk/gtkcssstaticstyle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c index 9ca869395a..b264dbc2c3 100644 --- a/gtk/gtkcssstaticstyle.c +++ b/gtk/gtkcssstaticstyle.c @@ -865,6 +865,7 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup, } else if (parent_style && parent_style->variables) { + g_clear_pointer (&style->variables, gtk_css_variable_set_unref); style->variables = gtk_css_variable_set_ref (parent_style->variables); }