]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix memory and fd leak in test-dhcp6-client
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Feb 2022 12:34:37 +0000 (21:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Feb 2022 12:50:43 +0000 (21:50 +0900)
Fixes an issue reported in #22576.

src/libsystemd-network/test-dhcp6-client.c

index b696db8b9eea5d09b690ea59757d9785d84b8b8a..f53e093d777af13186442bfc2551e2909d72a596 100644 (file)
@@ -78,8 +78,6 @@ static int test_ifindex = 42;
 static unsigned test_client_sent_message_count = 0;
 static sd_dhcp6_client *client_ref = NULL;
 
-STATIC_DESTRUCTOR_REGISTER(client_ref, sd_dhcp6_client_unrefp);
-
 static void test_client_basic(void) {
         _cleanup_(sd_dhcp6_client_unrefp) sd_dhcp6_client *client = NULL;
         int v;
@@ -1004,6 +1002,7 @@ static void test_dhcp6_client(void) {
 
         assert_se(test_client_sent_message_count == 4);
 
+        assert_se(!sd_dhcp6_client_unref(client_ref));
         test_fd[1] = safe_close(test_fd[1]);
 }