]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
INET: If we fail to add an address that already exists, don't free it
authorRoy Marples <roy@marples.name>
Tue, 22 Oct 2019 21:50:17 +0000 (22:50 +0100)
committerRoy Marples <roy@marples.name>
Tue, 22 Oct 2019 21:50:17 +0000 (22:50 +0100)
Should not happen in production.....

src/ipv4.c

index c55a7da6cb1d61c766c765596a3b1143f5e5fae5..f16b2a1f7dfd972a62027d805873248262d5718b 100644 (file)
@@ -687,7 +687,8 @@ ipv4_addaddr(struct interface *ifp, const struct in_addr *addr,
                if (errno != EEXIST)
                        logerr("%s: if_addaddress",
                            __func__);
-               free(ia);
+               if (ia->flags & IPV4_AF_NEW)
+                       free(ia);
                return NULL;
        }