[mutter/wip/carlosg/coverity-fixes: 13/13] clutter: Plug leak on error condition




commit 90ad8b88d49bb7d9c8366e5e8360f4c7db3c39f5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 25 00:18:39 2021 +0200

    clutter: Plug leak on error condition
    
    The ClutterContext is leaked if not properly initialized.
    
    CID: #1508079
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>

 clutter/clutter/clutter-main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-main.c b/clutter/clutter/clutter-main.c
index 8d3769e3ae..a2a841c59c 100644
--- a/clutter/clutter/clutter-main.c
+++ b/clutter/clutter/clutter-main.c
@@ -619,7 +619,10 @@ clutter_context_new (ClutterBackendConstructor   backend_constructor,
   clutter_context->last_repaint_id = 1;
 
   if (!clutter_init_real (clutter_context, error))
-    return NULL;
+    {
+      g_free (clutter_context);
+      return NULL;
+    }
 
   ClutterCntx = clutter_context;
 


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