From b646484505c3341d21dc8d7ae28754c1c7d67d60 Mon Sep 17 00:00:00 2001 From: cperciva Date: Tue, 24 Feb 2004 18:01:43 +0000 Subject: Check that a pointer is non-NULL before dereferencing it, not after. Reported by: "Ted Unangst" Approved by: rwatson (mentor) --- sys/netgraph/ng_gif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netgraph/ng_gif.c b/sys/netgraph/ng_gif.c index 794378b..1349690 100644 --- a/sys/netgraph/ng_gif.c +++ b/sys/netgraph/ng_gif.c @@ -265,10 +265,11 @@ static void ng_gif_detach(struct ifnet *ifp) { const node_p node = IFP2NG(ifp); - const priv_p priv = NG_NODE_PRIVATE(node); + const priv_p priv; if (node == NULL) /* no node (why not?), ignore */ return; + priv = NG_NODE_PRIVATE(node); NG_NODE_REALLY_DIE(node); /* Force real removal of node */ /* * We can't assume the ifnet is still around when we run shutdown -- cgit v1.1