mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-14 14:55:41 +00:00
Plug a reference leak: before doing 'goto again' we need to unref
ia->ia_ifa if there is any. Submitted by: Andrey Zonov <andrey zonov.org>
This commit is contained in:
parent
b9abeb9d99
commit
3c73180f55
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238573
@ -124,7 +124,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
|||||||
int n; /* scratchpad */
|
int n; /* scratchpad */
|
||||||
int error = 0;
|
int error = 0;
|
||||||
struct sockaddr_in *dst;
|
struct sockaddr_in *dst;
|
||||||
struct in_ifaddr *ia = NULL;
|
struct in_ifaddr *ia;
|
||||||
int isbroadcast, sw_csum;
|
int isbroadcast, sw_csum;
|
||||||
struct route iproute;
|
struct route iproute;
|
||||||
struct rtentry *rte; /* cache for ro->ro_rt */
|
struct rtentry *rte; /* cache for ro->ro_rt */
|
||||||
@ -198,6 +198,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
|||||||
|
|
||||||
dst = (struct sockaddr_in *)&ro->ro_dst;
|
dst = (struct sockaddr_in *)&ro->ro_dst;
|
||||||
again:
|
again:
|
||||||
|
ia = NULL;
|
||||||
/*
|
/*
|
||||||
* If there is a cached route,
|
* If there is a cached route,
|
||||||
* check that it is to the same destination
|
* check that it is to the same destination
|
||||||
@ -533,8 +534,11 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
|||||||
#endif
|
#endif
|
||||||
error = netisr_queue(NETISR_IP, m);
|
error = netisr_queue(NETISR_IP, m);
|
||||||
goto done;
|
goto done;
|
||||||
} else
|
} else {
|
||||||
|
if (ia != NULL)
|
||||||
|
ifa_free(&ia->ia_ifa);
|
||||||
goto again; /* Redo the routing table lookup. */
|
goto again; /* Redo the routing table lookup. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IPFIREWALL_FORWARD
|
#ifdef IPFIREWALL_FORWARD
|
||||||
@ -564,6 +568,8 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
|||||||
bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in));
|
bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in));
|
||||||
m->m_flags |= M_SKIP_FIREWALL;
|
m->m_flags |= M_SKIP_FIREWALL;
|
||||||
m_tag_delete(m, fwd_tag);
|
m_tag_delete(m, fwd_tag);
|
||||||
|
if (ia != NULL)
|
||||||
|
ifa_free(&ia->ia_ifa);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
#endif /* IPFIREWALL_FORWARD */
|
#endif /* IPFIREWALL_FORWARD */
|
||||||
|
Loading…
Reference in New Issue
Block a user