[mutter/wip/carlosg/coverity-fixes: 7/8] cogl: Plug leak in error path




commit e582910ba1ac77571b14c9585fe9847ab94338ab
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 25 00:05:41 2021 +0200

    cogl: Plug leak in error path
    
    If the renderer fails to connect, we were leaking the renderer.
    
    CID: #1505882

 cogl/cogl/cogl-context.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index 7ff9f050bb..25fdfa7fac 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -146,6 +146,7 @@ cogl_context_new (CoglDisplay *display,
       CoglRenderer *renderer = cogl_renderer_new ();
       if (!cogl_renderer_connect (renderer, error))
         {
+          cogl_object_unref (renderer);
           g_free (context);
           return NULL;
         }


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