diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index d36548aa7e66..079077745e13 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -681,6 +681,13 @@ sendit: done: if (ro == &iproute) RO_RTFREE(ro); + else if (rte == NULL) + /* + * If the caller supplied a route but somehow the reference + * to it has been released need to prevent the caller + * calling RTFREE on it again. + */ + ro->ro_rt = NULL; if (have_ia_ref) ifa_free(&ia->ia_ifa); return (error);