lwIP - A Lightweight TCP/IP stack - Bugs: bug #25705, Memory Leak in HTTPD.C
You are not allowed to post comments on this tracker with your current authentication level.
bug #25705: Memory Leak in HTTPD.C
Submitter: | Edward Harris <eharris> | ||
Submitted: | Wed 25 Feb 2009 03:18:19 PM UTC | ||
Category: | Contrib | Severity: | 3 - Normal |
Item Group: | Faulty Behaviour | Status: | Fixed |
Privacy: | Public | Assigned to: | goldsimon |
Open/Closed: | Closed | Planned Release: | None |
lwIP version: | CVS Head |
Sun 01 Mar 2009 05:51:21 PM UTC, comment #5: |
Simon Goldschmidt <goldsimon> |
Thu 26 Feb 2009 05:12:40 AM UTC, comment #4: Edward,
|
Dave Wilson <dawilson> |
Wed 25 Feb 2009 10:39:08 PM UTC, comment #3: I'm very confused now!
|
Edward Harris <eharris> |
Wed 25 Feb 2009 05:24:57 PM UTC, comment #2: Sorry - I forgot to mention that I agree that the original code would appear to leak the hs structure if it's not freed when you abort after multiple retries. You should also clean up the hs structure before freeing it, though - there's a file handle and buffer pointer in there, for example. As far as I can tell, the correct thing to do would be:
|
Dave Wilson <dawilson> |
Wed 25 Feb 2009 05:20:17 PM UTC, comment #1: There's actually a different bug here which caught me out last week and was causing connections to be improperly terminated. I've reworked the function as follows.
|
Dave Wilson <dawilson> |
Wed 25 Feb 2009 03:18:19 PM UTC, original submission:
The http_poll callback function does not free the http_state structure when aborts the current tcp.
|
Edward Harris <eharris> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 4 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2009-03-01 | goldsimon | Item Group | None | Faulty Behaviour | |
Status | None | Fixed | |||
Assigned to | None | goldsimon | |||
Open/Closed | Open | Closed |
Powered by Savane 3.13-caa5.
Corresponding source code
I think both suggested patches are correct, I've checked in this:
if ((hs == NULL) && (pcb->state == ESTABLISHED)) {
tcp_abort(pcb);
return ERR_ABRT;
} else if (hs != NULL) {
++hs->retries;
if (hs->retries == 4) {
tcp_arg(pcb, NULL);
mem_free(hs);
tcp_abort(pcb);
return ERR_ABRT;
}
send_data(pcb, hs);
}