From 7497b1f182cd16afa099f63e504796614b736457 Mon Sep 17 00:00:00 2001 From: ozaki-r Date: Mon, 11 Mar 2019 03:00:41 +0000 Subject: [PATCH] Add missing ifa_release on error paths --- sys/net/route.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index b12680719da5..29b22301a3b8 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $NetBSD: route.c,v 1.216 2018/10/30 05:56:02 ozaki-r Exp $ */ +/* $NetBSD: route.c,v 1.217 2019/03/11 03:00:41 ozaki-r Exp $ */ /*- * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.216 2018/10/30 05:56:02 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.217 2019/03/11 03:00:41 ozaki-r Exp $"); #include #ifdef RTFLUSH_DEBUG @@ -1504,6 +1504,8 @@ rt_update(struct rtentry *rt, struct rt_addrinfo *info, void *rtm) } if (new_ifa == NULL) ifa_release(ifa, &psref_ifa); + /* To avoid ifa_release below */ + ifa = NULL; } ifa_release(new_ifa, &psref_new_ifa); if (new_ifp && rt->rt_ifp != new_ifp && !if_is_deactivated(new_ifp)) { @@ -1525,6 +1527,7 @@ rt_update(struct rtentry *rt, struct rt_addrinfo *info, void *rtm) (void)ifp_changed; /* XXX gcc */ #endif out: + ifa_release(ifa, &psref_ifa); if_put(new_ifp, &psref_new_ifp); if_put(ifp, &psref_ifp);