network: check return value
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 9 Apr 2016 01:08:02 +0000 (21:08 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 9 Apr 2016 01:08:02 +0000 (21:08 -0400)
CID #1349698.

src/network/networkd-address-pool.c

index d9d487d..ebc6c9e 100644 (file)
@@ -148,8 +148,12 @@ int address_pool_acquire(AddressPool *p, unsigned prefixlen, union in_addr_union
         for (;;) {
                 if (!address_pool_prefix_is_taken(p, &u, prefixlen)) {
                         _cleanup_free_ char *s = NULL;
+                        int r;
+
+                        r = in_addr_to_string(p->family, &u, &s);
+                        if (r < 0)
+                                return r;
 
-                        in_addr_to_string(p->family, &u, &s);
                         log_debug("Found range %s/%u", strna(s), prefixlen);
 
                         *found = u;