]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Grab the state before freeing the address.
authorRoy Marples <roy@marples.name>
Thu, 19 May 2016 09:15:46 +0000 (09:15 +0000)
committerRoy Marples <roy@marples.name>
Thu, 19 May 2016 09:15:46 +0000 (09:15 +0000)
ipv4.c

diff --git a/ipv4.c b/ipv4.c
index 2e71278c563206f714c51695fd943aa6e7e820f1..844c84b78e112c76c6b49b9cc38e761601dd7be2 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -888,7 +888,6 @@ ipv4_buildroutes(struct dhcpcd_ctx *ctx)
 int
 ipv4_deladdr(struct ipv4_addr *addr, int keeparp)
 {
-       struct interface *ifp;
        int r;
        struct ipv4_state *state;
        struct ipv4_addr *ap;
@@ -911,10 +910,10 @@ ipv4_deladdr(struct ipv4_addr *addr, int keeparp)
                if (IPV4_MASK_EQ(ap, addr)) {
                        struct dhcp_state *dstate;
 
+                       dstate = D_STATE(ap->iface);
                        TAILQ_REMOVE(&state->addrs, ap, next);
                        free(ap);
 
-                       dstate = D_STATE(ifp);
                        if (dstate && dstate->addr == ap) {
                                dstate->added = 0;
                                dstate->addr = NULL;