Update net_test.c
申请内存失败时,直接return,此前代码goto _exit进行rt_free空指针,会造成内存泄漏
This commit is contained in:
parent
b809c02015
commit
f8a20ee433
|
@ -70,7 +70,7 @@ void udpecho_socket_entry(void *parameter)
|
||||||
{
|
{
|
||||||
/* no memory yet */
|
/* no memory yet */
|
||||||
rt_kprintf("no memory\n");
|
rt_kprintf("no memory\n");
|
||||||
goto _exit;
|
return;
|
||||||
}
|
}
|
||||||
/* create a UDP socket */
|
/* create a UDP socket */
|
||||||
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
|
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
|
||||||
|
@ -183,7 +183,7 @@ void tcpecho_socket_entry(void *parameter)
|
||||||
if (recv_data == RT_NULL)
|
if (recv_data == RT_NULL)
|
||||||
{
|
{
|
||||||
rt_kprintf("no memory\n");
|
rt_kprintf("no memory\n");
|
||||||
goto _exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a TCP socket */
|
/* create a TCP socket */
|
||||||
|
|
Loading…
Reference in New Issue