api_lib.c: somes resources couldn't be freed if there was errors during netconn_new_with_proto_and_callback.

This commit is contained in:
fbernon 2007-03-22 09:27:04 +00:00
parent 5fff6e7ff8
commit db739d16ce
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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;
}