libnm-client: fix memory leak

The test calls g_main_context_ref() on client_context, which must then
be unreferenced.

Fixes: 88724ff169 ('libnm: add nm_client_wait_shutdown() function for cleaning up NMClient')
This commit is contained in:
Beniamino Galvani 2025-09-05 14:37:17 +02:00 committed by Íñigo Huguet
parent 5ad712974e
commit d559f61423

View file

@ -1432,13 +1432,13 @@ test_client_wait_shutdown(void)
nmtst_assert_success(dbus_connection, error);
for (i_run = 0; i_run < N_RUN; i_run++) {
gs_unref_object GCancellable *init_cancellable = g_cancellable_new();
gs_unref_object NMClient *nmc = NULL;
nm_auto_pop_gmaincontext GMainContext *client_context = NULL;
gboolean b;
gboolean context_integrated = FALSE;
gs_unref_object GCancellable *cancellable_1 = NULL;
GMainContext *ctx;
gs_unref_object GCancellable *init_cancellable = g_cancellable_new();
gs_unref_object NMClient *nmc = NULL;
nm_auto_pop_and_unref_gmaincontext GMainContext *client_context = NULL;
gboolean b;
gboolean context_integrated = FALSE;
gs_unref_object GCancellable *cancellable_1 = NULL;
GMainContext *ctx;
/* Choose a random context for the client. */
ctx = contexts->pdata[nmtst_get_rand_uint32() % contexts->len];