mirror of https://github.com/RT-Thread/rt-thread
fix #4286,fifx memory leak when sal_socket failed
This commit is contained in:
parent
2d75100922
commit
542d65bc8a
|
@ -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 */
|
||||||
|
|
Loading…
Reference in New Issue