mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 11:30:01 +08:00
socket_new()成功后,后续函数不成功返回-1,没有删除socket
This commit is contained in:
@@ -917,6 +917,7 @@ int sal_socket(int domain, int type, int protocol)
|
||||
socket = socket_new();
|
||||
if (socket < 0)
|
||||
{
|
||||
socket_delete(socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -924,6 +925,7 @@ int sal_socket(int domain, int type, int protocol)
|
||||
sock = sal_get_socket(socket);
|
||||
if (sock == RT_NULL)
|
||||
{
|
||||
socket_delete(socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -956,7 +958,7 @@ int sal_socket(int domain, int type, int protocol)
|
||||
sock->user_data = (void *) proto_socket;
|
||||
return sock->socket;
|
||||
}
|
||||
|
||||
socket_delete(socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user