Merge pull request #2164 from alexstanoev/web-demo-crash-fix

Zero out httpd_state before deallocating
This commit is contained in:
George Oikonomou 2017-04-02 00:32:53 +01:00 committed by GitHub
commit 6eac73103d

View file

@ -1268,9 +1268,7 @@ appcall(void *state)
if(uip_closed() || uip_aborted() || uip_timedout()) { if(uip_closed() || uip_aborted() || uip_timedout()) {
if(s != NULL) { if(s != NULL) {
s->script = NULL; memset(s, 0, sizeof(struct httpd_state));
s->blen = 0;
s->tmp_buf_len = 0;
memb_free(&conns, s); memb_free(&conns, s);
} }
} else if(uip_connected()) { } else if(uip_connected()) {
@ -1291,7 +1289,7 @@ appcall(void *state)
if(uip_poll()) { if(uip_poll()) {
if(timer_expired(&s->timer)) { if(timer_expired(&s->timer)) {
uip_abort(); uip_abort();
s->script = NULL; memset(s, 0, sizeof(struct httpd_state));
memb_free(&conns, s); memb_free(&conns, s);
} }
} else { } else {