[mutter/wip/carlosg/coverity-fixes: 8/12] cogl: Plug possible GString leaks




commit c46e1c4c82ea8d215efbd43f4ff1507cea36ad3e
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 23:16:22 2021 +0200

    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

 cogl/cogl/cogl-pipeline-debug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/cogl-pipeline-debug.c b/cogl/cogl/cogl-pipeline-debug.c
index 7555257d09..9f1007b942 100644
--- a/cogl/cogl/cogl-pipeline-debug.c
+++ b/cogl/cogl/cogl-pipeline-debug.c
@@ -103,9 +103,10 @@ dump_layer_cb (CoglNode *node, void *user_data)
     {
       g_string_append_printf (changes_label, "\"];\n");
       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.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 (state->graph, changes_label->str);
-      g_string_free (changes_label, TRUE);
     }
 
+  g_string_free (changes_label, TRUE);
+
   if (layers)
     {
       g_list_foreach (pipeline->layer_differences,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]