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




commit 4ef365bea2f0c26e143e8a51051cd4aad0763870
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..d0f52ebc40 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]