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
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2061>
This commit is contained in:
Carlos Garnacho 2021-10-24 22:56:38 +02:00
parent b3046cca2d
commit 4dc07999c6

View File

@ -529,7 +529,7 @@ gboolean
cogl_renderer_connect (CoglRenderer *renderer, GError **error) cogl_renderer_connect (CoglRenderer *renderer, GError **error)
{ {
int i; int i;
GString *error_message; g_autoptr (GString) error_message = NULL;
gboolean constraints_failed = FALSE; gboolean constraints_failed = FALSE;
if (renderer->connected) if (renderer->connected)
@ -594,7 +594,6 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error)
else else
{ {
renderer->connected = TRUE; renderer->connected = TRUE;
g_string_free (error_message, TRUE);
return 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, g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT,
"Failed to connected to any renderer: %s", "Failed to connected to any renderer: %s",
error_message->str); error_message->str);
g_string_free (error_message, TRUE);
return FALSE; return FALSE;
} }