From 63e855d78a036891f1bcc49b771c928736288d7e Mon Sep 17 00:00:00 2001 From: Keyun-Johan <1003085792@qq.com> Date: Sun, 12 Apr 2020 19:22:19 +0800 Subject: [PATCH] =?UTF-8?q?socket=5Fnew()=E6=88=90=E5=8A=9F=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=90=8E=E7=BB=AD=E5=87=BD=E6=95=B0=E4=B8=8D=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E8=BF=94=E5=9B=9E-1=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=88=A0=E9=99=A4socket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/sal_socket/src/sal_socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c index e5c55f8bf8..a79890eb27 100644 --- a/components/net/sal_socket/src/sal_socket.c +++ b/components/net/sal_socket/src/sal_socket.c @@ -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; }