From: Cheoleun Moon Date: Thu, 8 Apr 2021 07:46:02 +0000 (+0900) Subject: tests: Free after use X-Git-Tag: submit/tizen/20210408.090200~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F31%2F256631%2F3;p=platform%2Fcore%2Fapi%2Fvine.git tests: Free after use Change-Id: I92b74905b6fc64567be9ae748f13bc1882b38074 Signed-off-by: Cheoleun Moon --- diff --git a/tests/unittest/vine-unittest-security.cpp b/tests/unittest/vine-unittest-security.cpp index 771a3d9..f8b4461 100755 --- a/tests/unittest/vine-unittest-security.cpp +++ b/tests/unittest/vine-unittest-security.cpp @@ -298,4 +298,5 @@ TEST_F(VineSecurityTest, GetPskP) EXPECT_EQ(VINE_ERROR_NONE, vine_security_get_psk(security, &psk)); + free(psk); } diff --git a/tests/verifier/vine-verifier.cpp b/tests/verifier/vine-verifier.cpp index fc10a37..bd33951 100644 --- a/tests/verifier/vine-verifier.cpp +++ b/tests/verifier/vine-verifier.cpp @@ -244,6 +244,7 @@ static void __register_service(vine_session_h session, int port) vine_session_set_registered_cb(session, __registered_cb, NULL); PRINT_IF_ERROR(vine_session_register(session, service, NULL), "vine_session_register"); + vine_service_destroy(service); } static void __server_opened_cb(vine_dp_h dp, vine_error_e result, void *user_data) diff --git a/tests/vine-test/vine-multi-thread-test.cpp b/tests/vine-test/vine-multi-thread-test.cpp index 7f9a831..1189d46 100644 --- a/tests/vine-test/vine-multi-thread-test.cpp +++ b/tests/vine-test/vine-multi-thread-test.cpp @@ -149,6 +149,9 @@ static void __discovered_cb(vine_session_h session, vine_service_h service, PRINT_IF_ERROR(ret, "vine_service_foreach_attribute"); PRINT_LOG("\n"); fflush(stdout); + + free(service_type); + free(service_name); } #define VINE_LOGGER_TIME_MESSAGE_LEN 17 diff --git a/tests/vine-test/vine-test.cpp b/tests/vine-test/vine-test.cpp index 2994cb9..4102b23 100644 --- a/tests/vine-test/vine-test.cpp +++ b/tests/vine-test/vine-test.cpp @@ -219,6 +219,9 @@ static void __ip_resolved_cb(vine_session_h session, vine_service_h service, PRINT_IF_ERROR(ret, "vine_service_foreach_attribute"); printf("\n"); fflush(stdout); + + free(service_type); + free(service_name); } static void __discovered_cb(vine_session_h session, vine_service_h service, @@ -554,8 +557,10 @@ static vine_security_h __create_security_handle(int type, bool is_server) if (vine_security_create(&s) != VINE_ERROR_NONE) return NULL; - if (vine_security_set_type(s, (vine_security_type_e)type) != VINE_ERROR_NONE) + if (vine_security_set_type(s, (vine_security_type_e)type) != VINE_ERROR_NONE) { + vine_security_destroy(s); return NULL; + } if (type >= VINE_SECURITY_TYPE_TLS) { vine_security_set_ca_path(s, ROOT_CA_PATH); @@ -612,7 +617,9 @@ static void __open_server() vine_dp_set_terminated_cb(g_server_dp, __terminated_cb, NULL); vine_dp_set_address_family(g_server_dp, (vine_address_family_e)addr_family); vine_dp_set_port(g_server_dp, port); - vine_dp_set_security(g_server_dp, __create_security_handle(security_type, true)); + vine_security_h security = __create_security_handle(security_type, true); + vine_dp_set_security(g_server_dp, security); + vine_security_destroy(security); PRINT_RESULT(vine_dp_open(g_server_dp, __opened_cb, NULL), "vine_dp_open"); } @@ -652,7 +659,9 @@ static void __connect_server() vine_dp_set_remote_ip(g_client_dp, addr_type ? VINE_ADDRESS_FAMILY_IPV6 : VINE_ADDRESS_FAMILY_IPV4, ip); PRINT_RESULT(vine_dp_set_port(g_client_dp, port), "vine_dp_set_port"); - vine_dp_set_security(g_client_dp, __create_security_handle(security_type, false)); + vine_security_h security = __create_security_handle(security_type, true); + vine_dp_set_security(g_client_dp, security); + vine_security_destroy(security); PRINT_RESULT(vine_dp_open(g_client_dp, __opened_cb, NULL), "vine_dp_open"); }