net: Fix memory leaks upon arp_fillheader() failures
Free memory before return from arprequest_internal(). In in_arpinput(), if arp_fillheader() fails, it should use goto drop. Reviewed by: melifaro, imp, markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/534
This commit is contained in:
parent
6598cababf
commit
f5777c123a
@ -418,6 +418,7 @@ arprequest_internal(struct ifnet *ifp, const struct in_addr *sip,
|
||||
linkhdrsize = sizeof(linkhdr);
|
||||
error = arp_fillheader(ifp, ah, 1, linkhdr, &linkhdrsize);
|
||||
if (error != 0 && error != EAFNOSUPPORT) {
|
||||
m_freem(m);
|
||||
ARP_LOG(LOG_ERR, "Failed to calculate ARP header on %s: %d\n",
|
||||
if_name(ifp), error);
|
||||
return (error);
|
||||
@ -1128,7 +1129,7 @@ in_arpinput(struct mbuf *m)
|
||||
if (error != 0 && error != EAFNOSUPPORT) {
|
||||
ARP_LOG(LOG_ERR, "Failed to calculate ARP header on %s: %d\n",
|
||||
if_name(ifp), error);
|
||||
return;
|
||||
goto drop;
|
||||
}
|
||||
|
||||
ro.ro_prepend = linkhdr;
|
||||
|
Loading…
Reference in New Issue
Block a user