socket_new()成功后,后续函数不成功返回-1,没有删除socket

This commit is contained in:
Keyun-Johan 2020-04-12 19:22:19 +08:00
parent 00f5094150
commit 63e855d78a
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}