summaryrefslogtreecommitdiff
path: root/src/network/networkd-address.c
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2014-06-30 10:35:48 +0530
committerTom Gundersen <teg@jklm.no>2014-07-01 10:38:07 +0200
commit0099bc15f14932c1d6e2bea4fc240038e45871dc (patch)
tree0ea099bb77cf44c3ffd191119d6f3000418c1263 /src/network/networkd-address.c
parent8469c1d329f983992805b6e6b44ff40e34adfc45 (diff)
networkd: address_acquire use cleanup macro
use cleanup macro for Address na [tomegun: dropped unneccessary braces]
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r--src/network/networkd-address.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 9c3e0e3376..76febc7a07 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -231,7 +231,7 @@ int address_update(Address *address, Link *link,
static int address_acquire(Link *link, Address *original, Address **ret) {
union in_addr_union in_addr = {};
struct in_addr broadcast = {};
- Address *na = NULL;
+ _cleanup_address_free_ Address *na = NULL;
int r;
assert(link);
@@ -274,11 +274,8 @@ static int address_acquire(Link *link, Address *original, Address **ret) {
if (original->label) {
na->label = strdup(original->label);
-
- if (!na->label) {
- free(na);
+ if (!na->label)
return -ENOMEM;
- }
}
na->broadcast = broadcast;
@@ -287,6 +284,8 @@ static int address_acquire(Link *link, Address *original, Address **ret) {
LIST_PREPEND(addresses, link->pool_addresses, na);
*ret = na;
+ na = NULL;
+
return 0;
}