summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcperciva <cperciva@FreeBSD.org>2004-02-24 18:01:43 +0000
committercperciva <cperciva@FreeBSD.org>2004-02-24 18:01:43 +0000
commitb646484505c3341d21dc8d7ae28754c1c7d67d60 (patch)
treea422dcba8ddee92c089a58a9aba78b5db58b626b /sys
parent87f83be68306918d6b117e924c0275d496e41511 (diff)
downloadFreeBSD-src-b646484505c3341d21dc8d7ae28754c1c7d67d60.zip
FreeBSD-src-b646484505c3341d21dc8d7ae28754c1c7d67d60.tar.gz
Check that a pointer is non-NULL before dereferencing it, not after.
Reported by: "Ted Unangst" <tedu@coverity.com> Approved by: rwatson (mentor)
Diffstat (limited to 'sys')
-rw-r--r--sys/netgraph/ng_gif.c3
1 files changed, 2 insertions, 1 deletions
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
OpenPOWER on IntegriCloud