cogl: Plug leak in error path

If the renderer fails to connect, we were leaking the renderer.

CID: #1505882
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
This commit is contained in:
Carlos Garnacho 2021-10-25 00:05:41 +02:00
parent ccaa4c049b
commit c869b92d5d

View File

@ -146,6 +146,7 @@ cogl_context_new (CoglDisplay *display,
CoglRenderer *renderer = cogl_renderer_new (); CoglRenderer *renderer = cogl_renderer_new ();
if (!cogl_renderer_connect (renderer, error)) if (!cogl_renderer_connect (renderer, error))
{ {
cogl_object_unref (renderer);
g_free (context); g_free (context);
return NULL; return NULL;
} }