Skip to content

Commit 3e40107

Browse files
authored
test_soap_connection_handler leaks memory when open_connection fails
sckt_data is not free'd when `coap_connection_handler_open_connection` fails.
1 parent a87c7c8 commit 3e40107

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

features/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ bool test_socket_api_callbacks()
403403
coap_conn_handler_t *handler = connection_handler_create(&receive_from_sock_cb, &send_to_sock_cb, NULL, NULL);
404404
nsdynmemlib_stub.returnCounter = 2;
405405
if (0 != coap_connection_handler_open_connection(handler, 22, false, false, true, false)) {
406+
free(sckt_data);
406407
return false;
407408
}
408409

@@ -483,6 +484,7 @@ bool test_security_callbacks()
483484
coap_conn_handler_t *handler = connection_handler_create(&receive_from_sock_cb, &send_to_sock_cb, NULL, NULL);
484485
nsdynmemlib_stub.returnCounter = 2;
485486
if (0 != coap_connection_handler_open_connection(handler, 22, false, true, true, false)) {
487+
free(sckt_data);
486488
return false;
487489
}
488490

0 commit comments

Comments
 (0)