fix #4286,fifx memory leak when sal_socket failed

This commit is contained in:
jianbaoshan 2025-07-14 15:27:47 +08:00 committed by Rbb666
parent 2d75100922
commit 542d65bc8a
1 changed files with 1 additions and 1 deletions

View File

@ -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 */