diff options
author | Daniel Mack <daniel@zonque.org> | 2015-07-29 20:25:57 +0200 |
---|---|---|
committer | Daniel Mack <daniel@zonque.org> | 2015-07-30 13:09:01 +0200 |
commit | 2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d (patch) | |
tree | c662c5bf209dae93822ac07a831882a7ba4ba0b2 /src/firstboot | |
parent | Merge pull request #783 from whot/hwdb-updates (diff) | |
download | systemd-2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d.tar.xz systemd-2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d.zip |
tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent,
open-coded versions.
Diffstat (limited to 'src/firstboot')
-rw-r--r-- | src/firstboot/firstboot.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 3805b29437..f06ab3da29 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -728,9 +728,8 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } - free(arg_locale); - arg_locale = strdup(optarg); - if (!arg_locale) + r = free_and_strdup(&arg_locale, optarg); + if (r < 0) return log_oom(); break; @@ -741,9 +740,8 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } - free(arg_locale_messages); - arg_locale_messages = strdup(optarg); - if (!arg_locale_messages) + r = free_and_strdup(&arg_locale_messages, optarg); + if (r < 0) return log_oom(); break; @@ -754,19 +752,16 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } - free(arg_timezone); - arg_timezone = strdup(optarg); - if (!arg_timezone) + r = free_and_strdup(&arg_timezone, optarg); + if (r < 0) return log_oom(); break; case ARG_ROOT_PASSWORD: - free(arg_root_password); - arg_root_password = strdup(optarg); - if (!arg_root_password) + r = free_and_strdup(&arg_root_password, optarg); + if (r < 0) return log_oom(); - break; case ARG_ROOT_PASSWORD_FILE: @@ -785,9 +780,8 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } - free(arg_hostname); - arg_hostname = strdup(optarg); - if (!arg_hostname) + r = free_and_strdup(&arg_hostname, optarg); + if (r < 0) return log_oom(); break; |