I have a class that executes the MSNP15 protocol. The protocol requires clients to perform frequent connection/disconnection to various servers like the dispatch server, login server and the switchboard server.
I decided to store the protocol related variables ( like ticket tokens, nonce etc ) as static member variables in a utility class like below:
class MsnUtility
{
public:
static void SetChallengeStringL ( const char *string );
static const char* GetChallengeString ( );
static void SetContactTicketL ( const char *ticket );
static const char* GetContactTicket ( );
private:
MsnUtility();
static char *iChallengeString;
static char *iContactTicket;
};
The static variables above are initialized to NULL at startup and then newed when the tokens become available as the protocol executes.
Since I don't have access to C++ standard library ( as I am developing on Symbian S60 platform ) I cannot use the string library. Will the allocated character pointers be freed when the program exits or is there any other mechanism by which I could ensure they are freed.
I am also open to alternative design suggestions.