[mutter/wip/carlosg/coverity-fixes: 6/12] cogl: Plug GString leak




commit 02d4bcf4073a17ac9e84de7b6a59b08e8428775c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 22:56:38 2021 +0200

    cogl: Plug GString leak
    
    In some error paths, this string was being leaked. Make it g_autoptr
    so it's done for us.
    
    CID: #1505903

 cogl/cogl/cogl-renderer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c
index d815757a0c..5b37d8634d 100644
--- a/cogl/cogl/cogl-renderer.c
+++ b/cogl/cogl/cogl-renderer.c
@@ -529,7 +529,7 @@ gboolean
 cogl_renderer_connect (CoglRenderer *renderer, GError **error)
 {
   int i;
-  GString *error_message;
+  g_autoptr (GString) error_message = NULL;
   gboolean constraints_failed = FALSE;
 
   if (renderer->connected)
@@ -594,7 +594,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
       else
         {
           renderer->connected = TRUE;
-          g_string_free (error_message, TRUE);
           return TRUE;
         }
     }
@@ -613,7 +612,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
       g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT,
                    "Failed to connected to any renderer: %s",
                    error_message->str);
-      g_string_free (error_message, TRUE);
       return FALSE;
     }
 


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