summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-05-19 14:16:36 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-05-19 14:16:36 +0000
commit359e7f10252077fe56447ae53997abc63494f5ce (patch)
treecb59ef6b2318371eedbe96bc10dfcc8522c2c53e
parentbb4a3570579c32ab4d10f5b869e11394816214f2 (diff)
Do not leak a rtentry if it is unusable.
Found by The Brainy Code Scanner from Maxime Villard.
-rw-r--r--sys/netinet/ip_icmp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 6a795012c77..665e9f6b7ec 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.133 2015/05/13 10:42:46 jsg Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.134 2015/05/19 14:16:35 mpi Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -928,8 +928,10 @@ icmp_mtudisc_clone(struct in_addr dst, u_int rtableid)
/* Check if the route is actually usable */
if (rt->rt_flags & (RTF_REJECT | RTF_BLACKHOLE) ||
- (rt->rt_flags & RTF_UP) == 0)
+ (rt->rt_flags & RTF_UP) == 0) {
+ rtfree(rt);
return (NULL);
+ }
/* If we didn't get a host route, allocate one */