[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-members] Bug: memory leak in etharp.c (Martin Glunz)
From: |
leon . woestenberg |
Subject: |
[lwip-members] Bug: memory leak in etharp.c (Martin Glunz) |
Date: |
Mon, 4 Nov 2002 15:23:55 +0100 |
Hello all,
there exist some nasty code in the etharp.c that leaks memory.
I think the bug report by Martin Glunz catches most of it, quote:
"When etharp_output() returns an ARP request instead of
the original packet, the pbuf containing the request
will not be freed."
I have verified this and yes, this seems to be a leak.
IT AFFECTS ALL CURRENT ETHERNET NETWORK INTERFACE DRIVERS
AS THE BUG FIX MUST OCCUR THERE (in driver_output()).
"My fix is the insertion of a new function
etharp_arp_free() that should be called after the
packet is sent."
This function does work, but I suggest to rename it to something
like etharp_output_sent().
Another alternative patch is to do this in the Ethernet drivers:
q = etharp_output(p);
if (q)
{
driver_transmit(q);
if (q != p) pbuf_free(q); /* if an ARP request was returned, free it */
}
Martin submitted another bug report, which I have not verified this
yet.
In addition to that, I have fixed a NULL pointer issue in etharp.c that
will
only bring problems in pre-emptive scheduling situations.
I will check in my fixes to etharp.c which I am confident about and will
not touch the rest.
All in all, etharp.c needs a code audit. I'm currently doing this, but I
welcome the eyes of more people.
Regards,
Leon Woestenberg
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-members] Bug: memory leak in etharp.c (Martin Glunz),
leon . woestenberg <=