Hi Nandika,

I have seen some complains about memory management of axiom_element_get_text() on the net.
My issue is that my C/UNIX application crashes when I use this function.

My code is:

axis2_char_t * axis_str;
while( node3 = axiom_children_iterator_next( response_it, env ) )
{
    ele3 = (axiom_element_t *) axiom_node_get_data_element( node3, env );
    axis_str = axiom_element_get_text( ele3, env, node3 );
    if( axis_str && strlen(axis_str) )
          AXIS2_FREE( env->allocator, axis_str );
}

Later on, when I exit the application, I call these 2 functions:
   axis2_svc_client_free(svc_client, env);
   axutil_env_free( env );

When I replaced the line
    axis_str = axiom_element_get_text( ele3, env, node3 );
with the following:
    axis_str = axiom_node_to_string( node3, env );
in the above code, the application doesn't crash anymore.

My questions are:
- how am I supposed to handle the pointer to axis2_char_t returned by axiom_element_get_text() and axiom_node_to_string()?
- should I call AXIS2_FREE for the axis2_char_t *, after I am done using it?
- can I safely reuse the pointer to axis2_char_t in the calls to axiom_element_get_text() or axiom_node_to_string(), such as in the above while loop?
- why using axiom_node_to_string() fixes the crash problem?  

Thanks,
Nadine --------------------------------------------------------------------- To unsubscribe, e-mail: c-user-unsubscr...@axis.apache.org For additional commands, e-mail: c-user-h...@axis.apache.org

Reply via email to