Skip to content
Permalink
Browse files
Fix memleaks in test_xpath_streaming
  • Loading branch information
bblough committed Aug 18, 2018
1 parent 2c740b4 commit efc9f4155492f314bf8191d2c4d43d71bf167fad
Showing 1 changed file with 15 additions and 6 deletions.
@@ -101,6 +101,7 @@ TEST_F(TestXPathStreaming, test_xpath_streaming) {

test_tree_str = axiom_node_to_string(test_tree, m_env);
printf("\nTesting XML\n-----------\n\"%s\"\n\n\n", test_tree_str);
AXIS2_FREE(m_env->allocator, test_tree_str);

axiom_node_free_tree(test_tree, m_env);

@@ -231,6 +232,7 @@ void evaluate(
if(!context)
{
printf("Could not initialise XPath context\n");
axiom_node_free_tree(test_tree, env);
return;
}

@@ -246,6 +248,9 @@ void evaluate(
printf("Compilation error.");
printf("Please check the systax of the XPath query.\n");

axiom_xpath_free_context(env, context);
axiom_node_free_tree(test_tree, env);

return;
}

@@ -258,7 +263,8 @@ void evaluate(
compare_result("");
printf("An error occured while evaluating the expression.\n");

axiom_xpath_free_expression(env, expr);
axiom_xpath_free_context(env, context);
axiom_node_free_tree(test_tree, env);

return;
}
@@ -268,7 +274,9 @@ void evaluate(
compare_result("");
printf("Streaming not supported.\n");

axiom_xpath_free_expression(env, expr);
axiom_xpath_free_result(env, result);
axiom_xpath_free_context(env, context);
axiom_node_free_tree(test_tree, env);

return;
}
@@ -280,10 +288,9 @@ void evaluate(
axiom_xpath_free_result(env, result);
}

if (expr)
{
axiom_xpath_free_expression(env, expr);
}
axiom_xpath_free_context(env, context);
axiom_node_free_tree(test_tree, env);

}

int compare_result(axis2_char_t *rs)
@@ -461,5 +468,7 @@ axiom_node_t *read_test_xml(const axutil_env_t *env, axis2_char_t *file_name)

while (axiom_document_build_next(document, env));

axiom_stax_builder_free_self(builder, env);

return root;
}

0 comments on commit efc9f41

Please sign in to comment.