From db739d16cecfbe3b2da2d2f2a8105b4c6d1b2e1c Mon Sep 17 00:00:00 2001 From: fbernon Date: Thu, 22 Mar 2007 09:27:04 +0000 Subject: [PATCH] api_lib.c: somes resources couldn't be freed if there was errors during netconn_new_with_proto_and_callback. --- CHANGELOG | 4 ++++ src/api/api_lib.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index b3912fc7..50b83e74 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -71,6 +71,10 @@ HISTORY ++ Bug fixes: + 2007-03-22 Frédéric Bernon + * api_lib.c: somes resources couldn't be freed if there was errors during + netconn_new_with_proto_and_callback. + 2007-03-22 Frédéric Bernon * ethernetif.c: update netif->input calls to check return value. In older ports, it's a good idea to upgrade them, even if before, there could be another problem diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 6922192a..b18d919f 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -221,6 +221,7 @@ netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto, conn->acceptmbox = SYS_MBOX_NULL; conn->sem = sys_sem_new(0); if (conn->sem == SYS_SEM_NULL) { + sys_mbox_free(conn->mbox); memp_free(MEMP_NETCONN, conn); return NULL; } @@ -238,6 +239,8 @@ netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto, api_msg_post(&msg); if ( conn->err != ERR_OK ) { + sys_sem_free(conn->sem); + sys_mbox_free(conn->mbox); memp_free(MEMP_NETCONN, conn); return NULL; }