mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
test-utils: Only initialize client when we're returning it
test_client_new might return early if conditions are not met, leaving some allocated data around without freeing it. Since we're not using the client before, there's no need to initialize it early and just initialize it when it's going to be returned. https://gitlab.gnome.org/GNOME/mutter/merge_requests/1195
This commit is contained in:
parent
1d75d5aa2f
commit
506e06589b
@ -427,7 +427,7 @@ test_client_new (const char *id,
|
|||||||
MetaWindowClientType type,
|
MetaWindowClientType type,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
TestClient *client = g_new0 (TestClient, 1);
|
TestClient *client;
|
||||||
GSubprocessLauncher *launcher;
|
GSubprocessLauncher *launcher;
|
||||||
GSubprocess *subprocess;
|
GSubprocess *subprocess;
|
||||||
MetaWaylandCompositor *compositor;
|
MetaWaylandCompositor *compositor;
|
||||||
@ -462,6 +462,7 @@ test_client_new (const char *id,
|
|||||||
if (!subprocess)
|
if (!subprocess)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
client = g_new0 (TestClient, 1);
|
||||||
client->type = type;
|
client->type = type;
|
||||||
client->id = g_strdup (id);
|
client->id = g_strdup (id);
|
||||||
client->cancellable = g_cancellable_new ();
|
client->cancellable = g_cancellable_new ();
|
||||||
|
Loading…
Reference in New Issue
Block a user