]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-hostname-util.c
Merge branch 'hostnamectl-dot-v2'
[thirdparty/systemd.git] / src / test / test-hostname-util.c
index 08be3f7bf2fdc911bce7ed3b8dc1de5e7f982c79..6f5ef2615e30ad6a78b3b01616fde2e469bcd644 100644 (file)
@@ -111,32 +111,28 @@ static void test_read_hostname_config(void) {
         write_string_file(path, "foo", WRITE_STRING_FILE_CREATE);
         assert_se(read_hostname_config(path, &hostname) == 0);
         assert_se(streq(hostname, "foo"));
-        free(hostname);
-        hostname = NULL;
+        hostname = mfree(hostname);
 
         /* with comment */
         write_string_file(path, "# comment\nfoo", WRITE_STRING_FILE_CREATE);
         assert_se(read_hostname_config(path, &hostname) == 0);
         assert_se(hostname);
         assert_se(streq(hostname, "foo"));
-        free(hostname);
-        hostname = NULL;
+        hostname = mfree(hostname);
 
         /* with comment and extra whitespace */
         write_string_file(path, "# comment\n\n foo ", WRITE_STRING_FILE_CREATE);
         assert_se(read_hostname_config(path, &hostname) == 0);
         assert_se(hostname);
         assert_se(streq(hostname, "foo"));
-        free(hostname);
-        hostname = NULL;
+        hostname = mfree(hostname);
 
         /* cleans up name */
         write_string_file(path, "!foo/bar.com", WRITE_STRING_FILE_CREATE);
         assert_se(read_hostname_config(path, &hostname) == 0);
         assert_se(hostname);
         assert_se(streq(hostname, "foobar.com"));
-        free(hostname);
-        hostname = NULL;
+        hostname = mfree(hostname);
 
         /* no value set */
         hostname = (char*) 0x1234;