Update net_sockets.c

修复创建socket失败仍然返回有效的fd
This commit is contained in:
Bluebear233 authored and GitHub committed 2018-05-27 21:37:08 +08:00
1 parent 51db86ca52
commit ec81f44ff9
1 file changed
+10
@@ -316,6 +316,16 @@ int socket(int domain, int type, int protocol)
rt_list_init(&(lwsock->wait_head));
lwsock->conn->callback = event_callback;
}
else
{
/* release fd */
fd_put(d);
fd_put(d);
rt_set_errno(-ENOMEM);
return -1;
}
/* release the ref-count of fd */
fd_put(d);