api.h, api_lib.c, sockets.c: netbuf_ref doesn't check its internal pbuf_alloc call result and can cause a crash. lwip_send now check netbuf_ref result.

This commit is contained in:
fbernon
2007-03-28 17:26:06 +00:00
parent d956a39fec
commit 913a99dd35
4 changed files with 24 additions and 23 deletions

View File

@@ -484,12 +484,11 @@ lwip_send(int s, const void *data, int size, unsigned int flags)
return -1;
}
/* make the buffer point to the data that should
be sent */
netbuf_ref(buf, data, size);
/* send the data */
err = netconn_send(sock->conn, buf);
/* make the buffer point to the data that should be sent */
if ((err = netbuf_ref(buf, data, size))==ERR_OK) {
/* send the data */
err = netconn_send(sock->conn, buf);
}
/* deallocated the buffer */
netbuf_delete(buf);