[En-Nut-Discussion] Netbuff freeing
Ralph Mason
ralph.mason at telogis.com
Sun Jul 20 03:26:12 CEST 2003
I noticed a problem, a program with just these lines will crash.
UDPSOCKET* sock = NutUdpCreateSocket(1234);
NutUdpSendTo(sock,0x12345678,123,"Hello world",13);
NutUdpDestroySocket(sock);
Why does crash? We when it cant send the Netbbuff (After querying the route
in NutIpOutput) it frees it and returns -1. Then NutUdpSendTo happily frees
it again.
However other places where it could return -1 (NutIpOutput if it cant
allocate memory) but not have freed the buffer.
So what's one to do?
I suggest that the code that creates an outgoing net buffer should always
be responsible for freeing it. This means that calling a send function will
*never* free the buffer.
Regards
Ralph
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003
More information about the En-Nut-Discussion
mailing list