From a9740c6a44ec231fda66c5433f4fad632258e649 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 15 Oct 2009 14:33:18 +0000 Subject: [PATCH] Fixed bug #27709: conn->err race condition on netconn_recv() timeout by directly returning when sys_arch_mbox_fetch times out. --- CHANGELOG | 4 ++++ src/api/api_lib.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0dcd903b..893eac16 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,10 @@ HISTORY ++ Bugfixes: + 2009-10-15: Simon Goldschmidt + * api_msg.c: Fixed bug #27709: conn->err race condition on netconn_recv() + timeout + 2009-10-15: Simon Goldschmidt * autoip.c: Fixed bug #27704: autoip starts with wrong address LWIP_AUTOIP_CREATE_SEED_ADDR() returned address in host byte order instead diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 86df911e..195a9a52 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -327,8 +327,9 @@ netconn_recv(struct netconn *conn) #if LWIP_SO_RCVTIMEO if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&p, conn->recv_timeout)==SYS_ARCH_TIMEOUT) { + memp_free(MEMP_NETBUF, buf); conn->err = ERR_TIMEOUT; - p = NULL; + return NULL; } #else sys_arch_mbox_fetch(conn->recvmbox, (void *)&p, 0);