]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
firstboot: clean-up the copied hostname, not argv[] directly, as that's ugly
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Dec 2020 15:44:04 +0000 (16:44 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 15 Dec 2020 17:00:02 +0000 (18:00 +0100)
src/firstboot/firstboot.c

index 48baae3f89a133ea855bd07da3652c68dbafaafc..afead11b42b0e9e034f5ab5d4082fb4e2127ea68 100644 (file)
@@ -1139,11 +1139,11 @@ static int parse_argv(int argc, char *argv[]) {
                                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                        "Host name %s is not valid.", optarg);
 
-                        hostname_cleanup(optarg);
                         r = free_and_strdup(&arg_hostname, optarg);
                         if (r < 0)
                                 return log_oom();
 
+                        hostname_cleanup(arg_hostname);
                         break;
 
                 case ARG_MACHINE_ID: