From 359e7f10252077fe56447ae53997abc63494f5ce Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Tue, 19 May 2015 14:16:36 +0000 Subject: Do not leak a rtentry if it is unusable. Found by The Brainy Code Scanner from Maxime Villard. --- sys/netinet/ip_icmp.c | 6 ++++-- 1 file 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 */ -- cgit v1.2.3