From 0f06910f66612eee00582df5e42c62e3d94771f8 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 1 Mar 2009 17:50:06 +0000 Subject: [PATCH] Fixed bug #25705 (memory leak in httpserver_raw when aborting connection) --- apps/httpserver_raw/httpd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/httpserver_raw/httpd.c b/apps/httpserver_raw/httpd.c index e13d8d0..387a908 100644 --- a/apps/httpserver_raw/httpd.c +++ b/apps/httpserver_raw/httpd.c @@ -106,13 +106,15 @@ http_poll(void *arg, struct tcp_pcb *pcb) hs = arg; /* printf("Polll\n");*/ - if (hs == NULL) { + if ((hs == NULL) && (pcb->state == ESTABLISHED)) { /* printf("Null, close\n");*/ tcp_abort(pcb); return ERR_ABRT; - } else { + } else if (hs != NULL) { ++hs->retries; if (hs->retries == 4) { + tcp_arg(pcb, NULL); + mem_free(hs); tcp_abort(pcb); return ERR_ABRT; }