[systemd-commits] src/libsystemd-network

Tom Gundersen tomegun at kemper.freedesktop.org
Tue Apr 29 12:58:05 PDT 2014


 src/libsystemd-network/sd-dhcp-lease.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit bc4155669aaf567e2d6fa1f1082d68012346629e
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Apr 29 21:57:11 2014 +0200

    sd-dhcp-lease: fix double realloc

diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c
index 648e6e2..acdcca8 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)++;
         }
 



More information about the systemd-commits mailing list