When we are using Xmotif routines such as XmTextGetString, XmTextGetSelection, which return a character pointer, these routines allocate storage for the returned string. This allocated memory should be freed by the programmer using XtFree ().
string getText( )
traceLog(eDebug,”Enetered getText () “);
char* pchText = NULL:
pchText = XmTextGetString (TextWidget);
strText = pchText;
traceLog(eDebug,”Got the getText ():[%s] “,
“strText.c_str () );
traceLog(eDebug,”Returning from getText () “);
Use XtFree( ) routine to free the memory allocated by the Xmotif routines which return a character pointer.