From 07ee187cb52f1ca6f975ae41bd56042bfd4b1ec1 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 14 Jan 2021 20:59:34 +0100 Subject: [PATCH] initrd: fix leak in test Fixes: 6069ef4b8bb6 ('initrd: accept a zero-byte prefix for BOOTIF') --- src/initrd/tests/test-cmdline-reader.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/initrd/tests/test-cmdline-reader.c b/src/initrd/tests/test-cmdline-reader.c index a809dff93..0c3014607 100644 --- a/src/initrd/tests/test-cmdline-reader.c +++ b/src/initrd/tests/test-cmdline-reader.c @@ -1951,18 +1951,19 @@ test_bootif_no_ip(void) static void test_bootif_hwtype(void) { - gs_unref_hashtable GHashTable *connections = NULL; const char *const *ARGV0 = NM_MAKE_STRV("ip=eth0:dhcp", "BOOTIF=01-00-53-AB-cd-02-03"); const char *const *ARGV1 = NM_MAKE_STRV("ip=eth0:dhcp", "BOOTIF=00-00-53-Ab-cD-02-03"); const char *const *ARGV[] = {ARGV0, ARGV1}; - NMConnection * connection; - NMSettingWired * s_wired; - NMSettingIPConfig *s_ip4; - NMSettingIPConfig *s_ip6; - gs_free char * hostname = NULL; guint i; for (i = 0; i < G_N_ELEMENTS(ARGV); i++) { + gs_unref_hashtable GHashTable *connections = NULL; + NMConnection * connection; + NMSettingWired * s_wired; + NMSettingIPConfig * s_ip4; + NMSettingIPConfig * s_ip6; + gs_free char * hostname = NULL; + connections = nmi_cmdline_reader_parse(TEST_INITRD_DIR "/sysfs", ARGV[i], &hostname); g_assert(connections); g_assert_cmpint(g_hash_table_size(connections), ==, 2);