Update net_test.c

申请内存失败时,直接return,此前代码goto _exit进行rt_free空指针,会造成内存泄漏
This commit is contained in:
David Lin 2020-10-14 09:56:53 +08:00 committed by GitHub
parent b809c02015
commit f8a20ee433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -70,7 +70,7 @@ void udpecho_socket_entry(void *parameter)
{
/* no memory yet */
rt_kprintf("no memory\n");
goto _exit;
return;
}
/* create a UDP socket */
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
@ -183,7 +183,7 @@ void tcpecho_socket_entry(void *parameter)
if (recv_data == RT_NULL)
{
rt_kprintf("no memory\n");
goto _exit;
return;
}
/* create a TCP socket */