Free mbuf chain when m_dup fails
Fix memory leak where mbuf chain wasn't free()d if iflib_ether_pad() has a failure in m_dup(). Reported by: "Ryan Stone" <rysto32@gmail.com> Sponsored by: Limelight Networks
This commit is contained in:
parent
97cb52fa9a
commit
04993890dc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326706
@ -3125,6 +3125,7 @@ iflib_ether_pad(device_t dev, struct mbuf **m_head, uint16_t min_frame_size)
|
|||||||
if (!M_WRITABLE(*m_head)) {
|
if (!M_WRITABLE(*m_head)) {
|
||||||
new_head = m_dup(*m_head, M_NOWAIT);
|
new_head = m_dup(*m_head, M_NOWAIT);
|
||||||
if (new_head == NULL) {
|
if (new_head == NULL) {
|
||||||
|
m_freem(*m_head);
|
||||||
device_printf(dev, "cannot pad short frame, m_dup() failed");
|
device_printf(dev, "cannot pad short frame, m_dup() failed");
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user