You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by bi...@apache.org on 2018/08/21 16:26:15 UTC
svn commit: r1838565 - in /axis/axis2/c/core/trunk/test/core:
clientapi/test_clientapi.cc context/test_context.cc
deployment/test_deployment.cc description/test_description.cc
engine/test_engine.cc transport/http/test_http_transport.cc
Author: billblough
Date: Tue Aug 21 16:26:15 2018
New Revision: 1838565
URL: http://svn.apache.org/viewvc?rev=1838565&view=rev
Log:
Fix memleaks in tests
Modified:
axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc
axis/axis2/c/core/trunk/test/core/context/test_context.cc
axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc
axis/axis2/c/core/trunk/test/core/description/test_description.cc
axis/axis2/c/core/trunk/test/core/engine/test_engine.cc
axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.cc
Modified: axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc?rev=1838565&r1=1838564&r2=1838565&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc (original)
+++ axis/axis2/c/core/trunk/test/core/clientapi/test_clientapi.cc Tue Aug 21 16:26:15 2018
@@ -136,6 +136,8 @@ build_om_payload_for_echo_svc(
axiom_element_create(env, echo_om_node, "text", NULL, &text_om_node);
axiom_element_set_text(text_om_ele, env, echo_text, text_om_node);
+ axiom_namespace_free(ns1, env);
+
return echo_om_node;
}
Modified: axis/axis2/c/core/trunk/test/core/context/test_context.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/context/test_context.cc?rev=1838565&r1=1838564&r2=1838565&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/context/test_context.cc (original)
+++ axis/axis2/c/core/trunk/test/core/context/test_context.cc Tue Aug 21 16:26:15 2018
@@ -83,7 +83,7 @@ TEST_F(TestContext, test_conf_ctx_init)
conf_ctx = axis2_conf_ctx_create(m_env, conf);
ASSERT_NE(conf_ctx, nullptr);
-
+
svc_grp1 = axis2_svc_grp_create(m_env);
ASSERT_NE(svc_grp1, nullptr);
svc_grp2 = axis2_svc_grp_create(m_env);
@@ -141,9 +141,9 @@ TEST_F(TestContext, test_conf_ctx_init)
if (svc_grp_ctx_map)
{
- axutil_hash_set(svc_ctx_map, "svc_grp_ctx1", AXIS2_HASH_KEY_STRING,
+ axutil_hash_set(svc_grp_ctx_map, "svc_grp_ctx1", AXIS2_HASH_KEY_STRING,
svc_grp_ctx1);
- axutil_hash_set(svc_ctx_map, "svc_grp_ctx2", AXIS2_HASH_KEY_STRING,
+ axutil_hash_set(svc_grp_ctx_map, "svc_grp_ctx2", AXIS2_HASH_KEY_STRING,
svc_grp_ctx2);
}
@@ -154,6 +154,14 @@ TEST_F(TestContext, test_conf_ctx_init)
CUT_ASSERT_INT_EQUAL(env->error->status_code, AXIS2_SUCCESS, 0);
*/
+ axutil_qname_free(qname1, m_env);
+ axutil_qname_free(qname2, m_env);
+ axis2_op_free(op, m_env);
+ axis2_svc_grp_free(svc_grp1, m_env);
+ axis2_svc_grp_free(svc_grp2, m_env);
+ axis2_svc_free(svc1, m_env);
+ axis2_svc_free(svc2, m_env);
+
axis2_conf_ctx_free(conf_ctx, m_env);
}
Modified: axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc?rev=1838565&r1=1838564&r2=1838565&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc (original)
+++ axis/axis2/c/core/trunk/test/core/deployment/test_deployment.cc Tue Aug 21 16:26:15 2018
@@ -108,7 +108,7 @@ TEST_F(TestDeployment, test_dep_engine_l
void *op = NULL;
axis2_char_t *oname = NULL;
printf("ops count = %d\n", axutil_hash_count(ops));
-
+
for (hi2 = axutil_hash_first(ops, m_env); hi2;
hi2 = axutil_hash_next(m_env, hi2))
{
@@ -163,6 +163,7 @@ TEST_F(TestDeployment, test_transport_re
axutil_dll_desc_set_type(dll_desc, m_env, AXIS2_TRANSPORT_RECV_DLL);
impl_info_param = axutil_param_create(m_env, NULL, NULL);
axutil_param_set_value(impl_info_param, m_env, dll_desc);
+ axutil_param_set_value_free(impl_info_param, m_env, axutil_dll_desc_free_void_arg);
axutil_class_loader_init(m_env);
transport_recv =
(axis2_transport_receiver_t *) axutil_class_loader_create_dll(m_env,
@@ -170,18 +171,26 @@ TEST_F(TestDeployment, test_transport_re
ASSERT_NE(transport_recv, nullptr);
is_running = axis2_transport_receiver_is_running(transport_recv, m_env);
printf("is_running:%d\n", is_running);
- AXIS2_FREE(m_env->allocator, dll_name);
printf("transport receiver load test successful\n");
-}
+ /* TODO wrap this in something cleaner? */
+ DELETE_FUNCT delete_funct = axutil_dll_desc_get_delete_funct(dll_desc, m_env);
+ if (delete_funct)
+ {
+ delete_funct(transport_recv, m_env);
+ }
+
+ AXIS2_FREE(m_env->allocator, dll_name);
+ axutil_param_free(impl_info_param, m_env);
+}
TEST_F(TestDeployment, test_transport_sender_load)
{
axutil_dll_desc_t *dll_desc = NULL;
axis2_char_t *dll_name = NULL;
- /*axis2_transport_sender_t *transport_sender = NULL;*/
axutil_param_t *impl_info_param = NULL;
axis2_char_t *axis2c_home = NULL;
+ axis2_transport_sender_t *transport_send = NULL;
printf("******************************************\n");
printf("testing axis2_transport_sender load\n");
@@ -196,12 +205,19 @@ TEST_F(TestDeployment, test_transport_se
axutil_dll_desc_set_type(dll_desc, m_env, AXIS2_TRANSPORT_SENDER_DLL);
impl_info_param = axutil_param_create(m_env, NULL, NULL);
axutil_param_set_value(impl_info_param, m_env, dll_desc);
+ axutil_param_set_value_free(impl_info_param, m_env, axutil_dll_desc_free_void_arg);
axutil_class_loader_init(m_env);
- /* transport_sender =
- (axis2_transport_sender_t *) */axutil_class_loader_create_dll(m_env,
- impl_info_param);
+ transport_send = (axis2_transport_sender_t *) axutil_class_loader_create_dll(m_env, impl_info_param);
+
+ /* TODO wrap this in something cleaner? */
+ DELETE_FUNCT delete_funct = axutil_dll_desc_get_delete_funct(dll_desc, m_env);
+ if (delete_funct)
+ {
+ delete_funct(transport_send, m_env);
+ }
AXIS2_FREE(m_env->allocator, dll_name);
+ axutil_param_free(impl_info_param, m_env);
printf("transport sender load test successful\n");
}
@@ -252,6 +268,7 @@ TEST_F(TestDeployment, test_default_modu
axis2_conf_get_all_modules
(axis_conf, m_env),
axis_conf);
+
def_mod = axis2_conf_get_default_module(axis_conf, m_env, "module1");
ASSERT_EQ(def_mod, module1);
def_mod = axis2_conf_get_default_module(axis_conf, m_env, "module2-0.92");
@@ -308,6 +325,7 @@ TEST_F(TestDeployment, test_default_modu
ASSERT_NE(found1, AXIS2_FALSE);
ASSERT_NE(found2, AXIS2_FALSE);
ASSERT_NE(found3, AXIS2_FALSE);
+
axis2_conf_free(axis_conf, m_env);
ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
}
Modified: axis/axis2/c/core/trunk/test/core/description/test_description.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/description/test_description.cc?rev=1838565&r1=1838564&r2=1838565&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/description/test_description.cc (original)
+++ axis/axis2/c/core/trunk/test/core/description/test_description.cc Tue Aug 21 16:26:15 2018
@@ -85,6 +85,9 @@ TEST_F(TestDescription, test_op_engage_m
ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
axis2_op_free(op, m_env);
+ axis2_conf_free(conf, m_env);
+ axis2_module_desc_free(moduleref, m_env);
+ axutil_qname_free(qname, m_env);
}
TEST_F(TestDescription, test_svc_add_module_ops)
@@ -115,6 +118,7 @@ TEST_F(TestDescription, test_svc_add_mod
axis2_svc_free(svc, m_env);
axis2_module_desc_free(module_desc, m_env);
axis2_conf_free(axis2_config, m_env);
+ axutil_qname_free(qname, m_env);
}
TEST_F(TestDescription, test_svc_engage_module)
@@ -138,24 +142,28 @@ TEST_F(TestDescription, test_svc_engage_
axis2_svc_free(svc, m_env);
axis2_conf_free(axis2_config, m_env);
+ axis2_module_desc_free(moduleref, m_env);
+ axutil_qname_free(qname, m_env);
}
TEST_F(TestDescription, test_svc_get_op)
{
struct axis2_svc *svc = NULL;
struct axutil_qname *qname = NULL;
+ struct axutil_qname *qname1 = NULL;
+ struct axutil_qname *qname2 = NULL;
struct axutil_hash_t *ops = NULL;
struct axis2_op *op = NULL;
qname = axutil_qname_create(m_env, "op1", NULL, NULL);
op = axis2_op_create_with_qname(m_env, qname);
- qname = axutil_qname_create(m_env, "svc1", NULL, NULL);
- svc = axis2_svc_create_with_qname(m_env, qname);
+ qname1 = axutil_qname_create(m_env, "svc1", NULL, NULL);
+ svc = axis2_svc_create_with_qname(m_env, qname1);
axis2_svc_add_op(svc, m_env, op);
- qname = axutil_qname_create(m_env, "op2", NULL, NULL);
- op = axis2_op_create_with_qname(m_env, qname);
+ qname2 = axutil_qname_create(m_env, "op2", NULL, NULL);
+ op = axis2_op_create_with_qname(m_env, qname2);
axis2_svc_add_op(svc, m_env, op);
ops = axis2_svc_get_all_ops(svc, m_env);
@@ -191,4 +199,9 @@ TEST_F(TestDescription, test_svc_get_op)
printf("ops count = zero\n");
ASSERT_EQ(m_env->error->status_code, AXIS2_SUCCESS);
+ axis2_svc_free(svc, m_env);
+ axutil_qname_free(qname, m_env);
+ axutil_qname_free(qname1, m_env);
+ axutil_qname_free(qname2, m_env);
+
}
Modified: axis/axis2/c/core/trunk/test/core/engine/test_engine.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/engine/test_engine.cc?rev=1838565&r1=1838564&r2=1838565&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/engine/test_engine.cc (original)
+++ axis/axis2/c/core/trunk/test/core/engine/test_engine.cc Tue Aug 21 16:26:15 2018
@@ -100,6 +100,7 @@ TEST_F(TestEngine, test_engine_send)
axis2_conf_ctx_free(conf_ctx, m_env);
axis2_msg_ctx_free(msg_ctx, m_env);
axutil_qname_free(qname, m_env);
+ axis2_svc_grp_free(svc_grp, m_env);
axis2_svc_grp_ctx_free(svc_grp_ctx, m_env);
axis2_svc_ctx_free(svc_ctx, m_env);
axis2_svc_free(svc, m_env);
Modified: axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.cc?rev=1838565&r1=1838564&r2=1838565&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.cc (original)
+++ axis/axis2/c/core/trunk/test/core/transport/http/test_http_transport.cc Tue Aug 21 16:26:15 2018
@@ -82,6 +82,7 @@ TEST_F(TestHTTPTransport, test_http_requ
axis2_http_request_line_get_http_version(request_line, m_env));
axis2_http_request_line_free(request_line, m_env);
+ AXIS2_FREE(m_env->allocator, request_line_str);
printf("Finished http_request_line tests ..........\n\n");
}
@@ -113,7 +114,7 @@ TEST_F(TestHTTPTransport, test_http_head
{
const char *header_name = "Content-Type";
const char *header_value = "text/xml";
- const char *str_header = (const char*) axutil_strdup(m_env,"Content-Type: text/xml; charset=UTF-8\r\n");
+ char *str_header = (char *)axutil_strdup(m_env,"Content-Type: text/xml; charset=UTF-8\r\n");
axis2_http_header_t *http_header;
axis2_char_t *external_form = NULL;
@@ -130,6 +131,8 @@ TEST_F(TestHTTPTransport, test_http_head
axis2_http_header_free(http_header, m_env);
http_header = axis2_http_header_create_by_str(m_env, str_header);
+ axis2_http_header_free(http_header, m_env);
+ AXIS2_FREE(m_env->allocator, str_header);
printf("Finished http_header tests ..........\n\n");
}
@@ -151,9 +154,10 @@ TEST_F(TestHTTPTransport, test_url)
axutil_url_free(url, m_env);
}
-/* Note: This test fails unless you have a deployed axis2c instance running the
+/* Note: This test fails unless you have a deployed axis2c instance with the
* echo service on the appropriate port, and AXIS2C_HOME defined in your
- * environment */
+ * environment.
+ */
TEST_F(TestHTTPTransport, test_http_client)
{
axis2_http_client_t *client = NULL;