summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-05-19 09:15:46 +0000
committerRoy Marples <roy@marples.name>2016-05-19 09:15:46 +0000
commit2eb2966f967ca0e70f7720fae31c1822fd7a615e (patch)
treed02e8a46934fc2673354f5d5e3847e0d4e9425f2
parent0b51734a3b30955f5d0055831f83e13314d79dbd (diff)
downloaddhcpcd-2eb2966f967ca0e70f7720fae31c1822fd7a615e.tar.xz
Grab the state before freeing the address.
-rw-r--r--ipv4.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ipv4.c b/ipv4.c
index 2e71278c..844c84b7 100644
--- 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;