summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-05-19 14:16:35 +0000
committermpi <mpi@openbsd.org>2015-05-19 14:16:35 +0000
commite05fd24f304441f7ca2d3885b7fe9892b46fee76 (patch)
tree762e0804c7fe550e15143fbc6e1c9eccffaa8f61 /sys
parentKeep visibility information for references to discarded sections. (diff)
downloadwireguard-openbsd-e05fd24f304441f7ca2d3885b7fe9892b46fee76.tar.xz
wireguard-openbsd-e05fd24f304441f7ca2d3885b7fe9892b46fee76.zip
Do not leak a rtentry if it is unusable.
Found by The Brainy Code Scanner from Maxime Villard.
Diffstat (limited to 'sys')
-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 */