From 3e4010748c0b405a7ecb8fbafa7aab46f08fdcc2 Mon Sep 17 00:00:00 2001 From: Jan Jongboom Date: Thu, 7 Mar 2019 16:27:59 +0100 Subject: [PATCH] test_soap_connection_handler leaks memory when open_connection fails sckt_data is not free'd when `coap_connection_handler_open_connection` fails. --- .../coap_connection_handler/test_coap_connection_handler.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/features/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c b/features/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c index 7cc1c6d16b..7ac183c80c 100644 --- a/features/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c +++ b/features/nanostack/coap-service/test/coap-service/unittest/coap_connection_handler/test_coap_connection_handler.c @@ -403,6 +403,7 @@ bool test_socket_api_callbacks() coap_conn_handler_t *handler = connection_handler_create(&receive_from_sock_cb, &send_to_sock_cb, NULL, NULL); nsdynmemlib_stub.returnCounter = 2; if (0 != coap_connection_handler_open_connection(handler, 22, false, false, true, false)) { + free(sckt_data); return false; } @@ -483,6 +484,7 @@ bool test_security_callbacks() coap_conn_handler_t *handler = connection_handler_create(&receive_from_sock_cb, &send_to_sock_cb, NULL, NULL); nsdynmemlib_stub.returnCounter = 2; if (0 != coap_connection_handler_open_connection(handler, 22, false, true, true, false)) { + free(sckt_data); return false; }