From 19d8ffe17735c3dd4172506d1963264de8970aac Mon Sep 17 00:00:00 2001 From: kieranm Date: Mon, 20 Sep 2004 16:58:01 +0000 Subject: [PATCH] Kieran Mansley - kjm25@cam.ac.uk - 20th September 2004 * Check if the pbuf is NULL before freeing it, when draining the mbox as part of netconn_delete. --- src/api/api_lib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 93c0e453..48d0a384 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -280,9 +280,10 @@ netconn_delete(struct netconn *conn) if (conn->recvmbox != SYS_MBOX_NULL) { while (sys_arch_mbox_fetch(conn->recvmbox, &mem, 1) != SYS_ARCH_TIMEOUT) { if (conn->type == NETCONN_TCP) { - pbuf_free((struct pbuf *)mem); + if(mem != NULL) + pbuf_free((struct pbuf *)mem); } else { - netbuf_delete((struct netbuf *)mem); + netbuf_delete((struct netbuf *)mem); } } sys_mbox_free(conn->recvmbox);