summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 9e5b7772ac..49802d6fdf 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -877,17 +877,15 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_NETWORK_ZONE: {
- char *j;
+ _cleanup_free_ char *j = NULL;
j = strjoin("vz-", optarg);
if (!j)
return log_oom();
- if (!ifname_valid(j)) {
- log_error("Network zone name not valid: %s", j);
- free(j);
- return -EINVAL;
- }
+ if (!ifname_valid(j))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Network zone name not valid: %s", j);
free_and_replace(arg_network_zone, j);