osrf_message_set_result( msg, data );
// Serialize the OSRF message into JSON text
- char* json = jsonObjectToJSON( osrfMessageToJSON( msg ));
+ jsonObject* msg_jsonobj = osrfMessageToJSON( msg );
+ char* json = jsonObjectToJSON( msg_jsonobj );
+ jsonObjectFree( msg_jsonobj );
osrfMessageFree( msg );
// If the new message would overflow the buffer, flush the output buffer first
OSRF_STATUS_COMPLETE );
// Serialize the STATUS message into JSON text
- char* json = jsonObjectToJSON( osrfMessageToJSON( status_msg ));
+ jsonObject* status_msg_jsonobj = osrfMessageToJSON( status_msg );
+ char* json = jsonObjectToJSON( status_msg_jsonobj );
+ jsonObjectFree( status_msg_jsonobj );
osrfMessageFree( status_msg );
// Add the STATUS message to the output buffer.