httpd: fix memory leak when LWIP_HTTPD_SUPPORT_REQUESTLIST==1 and connection is closed while trying to parse a request (should not happen on correct connections)

This commit is contained in:
Simon Goldschmidt 2014-08-20 21:47:29 +02:00
parent 80ae68d1be
commit 47ab4b0f98
1 changed files with 8 additions and 0 deletions

View File

@ -574,6 +574,12 @@ http_state_eof(struct http_state *hs)
hs->ssi = NULL;
}
#endif /* LWIP_HTTPD_SSI */
#if LWIP_HTTPD_SUPPORT_REQUESTLIST
if (hs->req) {
pbuf_free(hs->req);
hs->req = NULL;
}
#endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */
}
/** Free a struct http_state.
@ -2342,6 +2348,8 @@ http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|| parsed == ERR_INPROGRESS ||parsed == ERR_ARG || parsed == ERR_USE);
} else {
LWIP_DEBUGF(HTTPD_DEBUG, ("http_recv: already sending data\n"));
/* already sending but still receiving data, we might want to RST here? */
pbuf_free(p);
}
#if LWIP_HTTPD_SUPPORT_REQUESTLIST
if (parsed != ERR_INPROGRESS) {