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/18 16:12:19 UTC

svn commit: r1838344 - /axis/axis2/c/core/trunk/axiom/test/xpath/test_xpath_streaming.cc

Author: billblough
Date: Sat Aug 18 16:12:19 2018
New Revision: 1838344

URL: http://svn.apache.org/viewvc?rev=1838344&view=rev
Log:
Fix memleaks in test_xpath_streaming

Modified:
    axis/axis2/c/core/trunk/axiom/test/xpath/test_xpath_streaming.cc

Modified: axis/axis2/c/core/trunk/axiom/test/xpath/test_xpath_streaming.cc
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/axiom/test/xpath/test_xpath_streaming.cc?rev=1838344&r1=1838343&r2=1838344&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/axiom/test/xpath/test_xpath_streaming.cc (original)
+++ axis/axis2/c/core/trunk/axiom/test/xpath/test_xpath_streaming.cc Sat Aug 18 16:12:19 2018
@@ -101,6 +101,7 @@ TEST_F(TestXPathStreaming, test_xpath_st
 
     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
 
     while (axiom_document_build_next(document, env));
 
+    axiom_stax_builder_free_self(builder, env);
+
     return root;
 }