mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-05-25 21:26:12 +08:00
fix #4286,fifx memory leak when sal_socket failed
This commit is contained in:
@@ -657,12 +657,12 @@ int socket(int domain, int type, int protocol)
|
|||||||
rt_set_errno(-ENOMEM);
|
rt_set_errno(-ENOMEM);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
dfs_vnode_init(d->vnode, FT_SOCKET, dfs_net_get_fops());
|
||||||
|
|
||||||
/* create socket and then put it to the dfs_file */
|
/* create socket and then put it to the dfs_file */
|
||||||
socket = sal_socket(domain, type, protocol);
|
socket = sal_socket(domain, type, protocol);
|
||||||
if (socket >= 0)
|
if (socket >= 0)
|
||||||
{
|
{
|
||||||
dfs_vnode_init(d->vnode, FT_SOCKET, dfs_net_get_fops());
|
|
||||||
d->flags = O_RDWR; /* set flags as read and write */
|
d->flags = O_RDWR; /* set flags as read and write */
|
||||||
|
|
||||||
/* set socket to the data of dfs_file */
|
/* set socket to the data of dfs_file */
|
||||||
|
|||||||
Reference in New Issue
Block a user