From 6fc6abc2db027259b3070496ce92ef245eb39b04 Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Wed, 4 Nov 2015 10:13:56 +0000 Subject: rtfree(9) accepts NULL pointers. --- sys/net/route.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sys/net/route.c') diff --git a/sys/net/route.c b/sys/net/route.c index 42086f7b126..e7f04b7a6c7 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.267 2015/11/02 14:40:09 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.268 2015/11/04 10:13:55 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -477,8 +477,7 @@ rtredirect(struct sockaddr *dst, struct sockaddr *gateway, * Create new route, rather than smashing route to net. */ create: - if (rt) - rtfree(rt); + rtfree(rt); flags |= RTF_GATEWAY | RTF_DYNAMIC; bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; @@ -1236,8 +1235,7 @@ rt_ifa_addlocal(struct ifaddr *ifa) rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); if (rt == NULL || !ISSET(rt->rt_flags, flags)) error = rt_ifa_add(ifa, flags, ifa->ifa_addr); - if (rt) - rtfree(rt); + rtfree(rt); return (error); } @@ -1286,8 +1284,7 @@ rt_ifa_dellocal(struct ifaddr *ifa) rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); if (rt != NULL && ISSET(rt->rt_flags, flags)) error = rt_ifa_del(ifa, flags, ifa->ifa_addr); - if (rt) - rtfree(rt); + rtfree(rt); return (error); } -- cgit v1.2.3