cogl: Plug possible GString leaks

These strings are leaked if there are no changes to log. This is
perhaps never true, but this anyway good for clarity.

CIDs: #1505840, #1505884
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
This commit is contained in:
Carlos Garnacho 2021-10-24 23:16:22 +02:00
parent 025dbbbc94
commit ed9650ff42

View File

@ -103,9 +103,10 @@ dump_layer_cb (CoglNode *node, void *user_data)
{ {
g_string_append_printf (changes_label, "\"];\n"); g_string_append_printf (changes_label, "\"];\n");
g_string_append (state->graph, changes_label->str); g_string_append (state->graph, changes_label->str);
g_string_free (changes_label, TRUE);
} }
g_string_free (changes_label, TRUE);
state_out.parent_id = layer_id; state_out.parent_id = layer_id;
state_out.node_id_ptr = state->node_id_ptr; state_out.node_id_ptr = state->node_id_ptr;
@ -210,9 +211,10 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
{ {
g_string_append_printf (changes_label, "\"];\n"); g_string_append_printf (changes_label, "\"];\n");
g_string_append (state->graph, changes_label->str); g_string_append (state->graph, changes_label->str);
g_string_free (changes_label, TRUE);
} }
g_string_free (changes_label, TRUE);
if (layers) if (layers)
{ {
g_list_foreach (pipeline->layer_differences, g_list_foreach (pipeline->layer_differences,