axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shailesh Srivastava" <>
Subject RE: [AXIS2C] memory management
Date Tue, 19 Jun 2007 03:52:04 GMT
Once the response string is formed, you need to free the local memory
allocated to "retVal".

-----Original Message-----
From: Dr. Florian Steinborn [] 
Sent: Monday, June 18, 2007 6:47 PM
Subject: [AXIS2C] memory management

Hi friends,

just a "simple" question...
When you define a webservice that has an operation that returns a
you probably will get a generated function similiar to this:

/* starts here */

axis2_skel_<servicename>_getString ( const axutil_env_t *env  ,
                                 axis2_getString_t* getString )
     axis2_getStringResponse_t*  getStringRes = NULL;
     axis2_char_t*               retVal = NULL ;

     retVal = (axis2_char_t*) malloc( sizeof(char) * 20);
     strncpy( retVal, "NONSENS", 20);

     getStringRes = axis2_getStringResponse_create( env);
     axis2_getStringResponse_set_return( getStringRes, env, retVal) ;

     return getStringRes;


/* ends here */

The big question is: who cares for the memory allocated in "retVal" ? Do
have to free it or is it freed automatically by the Axis2 machine after

serializing the answer? A small string may not be interesting but when
have to fill structs or arrays of structs... ?



To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message