diff options
author | Tom Gundersen <teg@jklm.no> | 2015-01-10 00:33:46 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-01-12 18:19:16 +0100 |
commit | 9c39eb5c88dbca491e97a44acde43f88ef33a236 (patch) | |
tree | 093f0cb86f2335e8251e708e7e1bff218ffb60b1 | |
parent | 76c37ab6d205c95e8f43ffbc19553b936330195a (diff) |
network-intenal: user _cleanup_ macro in parse_ifname
-rw-r--r-- | src/libsystemd-network/network-internal.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c index 6852a7129a..e4a15d0b8a 100644 --- a/src/libsystemd-network/network-internal.c +++ b/src/libsystemd-network/network-internal.c @@ -224,7 +224,7 @@ int config_parse_ifalias(const char *unit, void *userdata) { char **s = data; - char *n; + _cleanup_free_ char *n = NULL; assert(filename); assert(lvalue); @@ -238,17 +238,15 @@ int config_parse_ifalias(const char *unit, if (!ascii_is_valid(n) || strlen(n) >= IFALIASZ) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Interface alias is not ASCII clean or is too long, ignoring assignment: %s", rvalue); - free(n); return 0; } free(*s); - if (*n) + if (*n) { *s = n; - else { - free(n); + n = NULL; + } else *s = NULL; - } return 0; } |