css: Fix freeing of calc values

We were getting our memory allocations mixed
up here.

Fixes: #5130
This commit is contained in:
Matthias Clasen 2022-08-22 11:51:20 -04:00
parent 317d4c8f8d
commit dc397fce3c

View File

@ -28,6 +28,7 @@
static GtkCssValue * gtk_css_calc_value_new (guint n_terms); static GtkCssValue * gtk_css_calc_value_new (guint n_terms);
static GtkCssValue * gtk_css_calc_value_new_sum (GtkCssValue *a, static GtkCssValue * gtk_css_calc_value_new_sum (GtkCssValue *a,
GtkCssValue *b); GtkCssValue *b);
static gsize gtk_css_value_calc_get_size (gsize n_terms);
enum { enum {
TYPE_CALC = 0, TYPE_CALC = 0,
@ -78,9 +79,13 @@ gtk_css_value_number_free (GtkCssValue *number)
for (guint i = 0; i < n_terms; i++) for (guint i = 0; i < n_terms; i++)
_gtk_css_value_unref (number->calc.terms[i]); _gtk_css_value_unref (number->calc.terms[i]);
}
g_slice_free (GtkCssValue, number); g_slice_free1 (gtk_css_value_calc_get_size (n_terms), number);
}
else
{
g_slice_free (GtkCssValue, number);
}
} }
static double static double