From 11304949deb36d2f9abbcda87d398496e892dcec Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Fri, 12 Feb 2021 20:56:52 +0000 Subject: [PATCH] Fix ifa refcount leak during route addition. Reported by: rstone Reviewed by: rstone (cherry picked from commit a375ec52a7b423133f66878ecf002efc3b6e9fca) --- sys/net/route/route_ctl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 6b0869196d1..9aedfb9d585 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -594,14 +594,12 @@ create_rtentry(struct rib_head *rnh, struct rt_addrinfo *info, } error = nhop_create_from_info(rnh, info, &nh); - if (error != 0) { - ifa_free(info->rti_ifa); + ifa_free(info->rti_ifa); + if (error != 0) return (error); - } rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); if (rt == NULL) { - ifa_free(info->rti_ifa); nhop_free(nh); return (ENOBUFS); }