diff --git a/components/dfs/filesystems/net/net_sockets.c b/components/dfs/filesystems/net/net_sockets.c index d4b6ea9e31..58f16425ba 100644 --- a/components/dfs/filesystems/net/net_sockets.c +++ b/components/dfs/filesystems/net/net_sockets.c @@ -320,6 +320,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);