summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2011-05-02 22:16:34 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2011-05-02 22:16:34 +0000
commit337d225e2e17f37434932257ab533d685decf0fc (patch)
treec6a3c571c297ced1bea7d4e23f5e3b9c380a8957
parent550d7bec7d6ef3410aa3be8d26b49c05ac7b8d96 (diff)
Fix potential null dereference.
Found by LLVM/Clang Static Analyzer. ok claudio@ henning@
-rw-r--r--sys/netinet6/frag6.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 8e80accd150..2e21e9654c3 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frag6.c,v 1.33 2011/04/03 13:54:21 stsp Exp $ */
+/* $OpenBSD: frag6.c,v 1.34 2011/05/02 22:16:33 chl Exp $ */
/* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */
/*
@@ -202,8 +202,10 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL)
dstifp = ((struct in6_ifaddr *)ro.ro_rt->rt_ifa)->ia_ifp;
- RTFREE(ro.ro_rt);
- ro.ro_rt = NULL;
+ if (ro.ro_rt != NULL) {
+ RTFREE(ro.ro_rt);
+ ro.ro_rt = NULL;
+ }
#else
/* we are violating the spec, this is not the destination interface */
if ((m->m_flags & M_PKTHDR) != 0)