Hello folks,
In my webservice I do some processing and then call the following function
to prepare the response to be sent to the client
1. axiom_node_t * BuildResponse(const axutil_env_t *env, axis2_char_t
*fileName)
2. {
3. axiom_node_t *resp_om_node = NULL;
4. axiom_element_t* resp_om_ele = NULL;
5. axiom_node_t* fileName_om_node = NULL;
6. axiom_element_t* fileName_om_ele = NULL;
7. axiom_namespace_t *ns = NULL;
8. ns = axiom_namespace_create(env, NAMESPACE_URI, NAMESPACE_PREFIX);
9. resp_om_ele = axiom_element_create(env, NULL, "MyResponse", ns,
&resp_om_node);
10. fileName_om_ele = axiom_element_create(env, resp_om_node, "MyID", ns,
&fileName_om_node);
11. axiom_element_set_text(fileName_om_ele, env, fileName,
fileName_om_node);
12. return resp_om_node;
}
The node returned from the above function is returned as it is to the client
without any further modification.
My question is, since I am explicitly creating the resp_om_ele and
fileName_om_ele, I should be freeing them too, right? But where exactly do I
do that? Can I do that right after line 11? But then what happens to the
resp_om_node?
Or should I not be worrying about freeing the two elements?
Please advise.
Subra