Fix a case where the return value from m_copy() was not being checked

for NULL before proceeding, causing a crash if mbufs were exhausted.

MFC after:	3 days
Reported by:	Mark Gooderum <mark@verniernetworks.com>
This commit is contained in:
archie 2003-04-23 18:35:40 +00:00
parent 485007051a
commit 84db389df4

View File

@ -281,13 +281,13 @@ ether_output(ifp, m, dst, rt0)
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n;
n = m_copy(m, 0, (int)M_COPYALL);
n->m_pkthdr.csum_flags |= csum_flags;
if (csum_flags & CSUM_DATA_VALID)
n->m_pkthdr.csum_data = 0xffff;
(void) if_simloop(ifp, n, dst->sa_family, hlen);
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
n->m_pkthdr.csum_flags |= csum_flags;
if (csum_flags & CSUM_DATA_VALID)
n->m_pkthdr.csum_data = 0xffff;
(void)if_simloop(ifp, n, dst->sa_family, hlen);
}
} else if (bcmp(eh->ether_dhost, eh->ether_shost,
ETHER_ADDR_LEN) == 0) {
m->m_pkthdr.csum_flags |= csum_flags;