Correctly fix bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer

This commit is contained in:
goldsimon 2016-10-04 12:29:22 +02:00
parent d9c6badc55
commit cdc97d2779

View File

@ -781,6 +781,7 @@ netconn_drain(struct netconn *conn)
#if LWIP_TCP #if LWIP_TCP
if (sys_mbox_valid(&conn->acceptmbox)) { if (sys_mbox_valid(&conn->acceptmbox)) {
while (sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) { while (sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) {
if (mem != &netconn_aborted) {
struct netconn *newconn = (struct netconn *)mem; struct netconn *newconn = (struct netconn *)mem;
/* Only tcp pcbs have an acceptmbox, so no need to check conn->type */ /* Only tcp pcbs have an acceptmbox, so no need to check conn->type */
/* pcb might be set to NULL already by err_tcp() */ /* pcb might be set to NULL already by err_tcp() */
@ -792,6 +793,7 @@ netconn_drain(struct netconn *conn)
} }
netconn_free(newconn); netconn_free(newconn);
} }
}
sys_mbox_free(&conn->acceptmbox); sys_mbox_free(&conn->acceptmbox);
sys_mbox_set_invalid(&conn->acceptmbox); sys_mbox_set_invalid(&conn->acceptmbox);
} }