summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-04-29 21:57:11 +0200
committerTom Gundersen <teg@jklm.no>2014-04-29 21:57:59 +0200
commitbc4155669aaf567e2d6fa1f1082d68012346629e (patch)
tree071d48848766b4490ebc2183394631f7c9fa28ea
parentd38cbe1bb7382782226b4b72944c9f7a7cf3eca1 (diff)
sd-dhcp-lease: fix double realloc
-rw-r--r--src/libsystemd-network/sd-dhcp-lease.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 648e6e2159..acdcca87ec 100644
--- a/src/libsystemd-network/sd-dhcp-lease.c
+++ b/src/libsystemd-network/sd-dhcp-lease.c
@@ -330,12 +330,13 @@ static int deserialize_addresses(struct in_addr **addresses, size_t *size, const
new_addresses = realloc(*addresses, (*size + 1) * sizeof(struct in_addr));
if (!new_addresses)
return -ENOMEM;
+ else
+ *addresses = new_addresses;
r = inet_aton(word, &(new_addresses[*size]));
if (r < 0)
continue;
- *addresses = new_addresses;
(*size)++;
}