Check that a pointer is non-NULL before dereferencing it, not after.

Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor)
This commit is contained in:
Colin Percival 2004-02-24 18:01:43 +00:00
parent fbd2e692fa
commit 3f54070bd2

View file

@ -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