rem: free(wtext->text.txt);
add: wfree(wtext->text.txt);
context: textInsert( WTextInput *wtext, char *txt )  {  char *newTxt;  int  newLen, txtLen, i,j;  int  sp,ep;    /* we need sp < ep */  if( wtext->text.startPos > wtext->text.endPos )    {    sp = wtext->text.endPos;    ep = wtext->text.startPos;    }  else    {    sp = wtext->text.startPos;    ep = wtext->text.endPos;    }    txtLen = strlen(txt);  newLen = wtext->text.length + txtLen - (ep - sp) + 1;    newTxt = (char *)malloc(newLen*sizeof(char));    /* copy the old text up to sp */  for( i=0; i<sp; i++ )    newTxt[i] = wtext->text.txt[i];    /* insert new text */  for( j=0; j<txtLen; j++,i++ )    newTxt[i] = txt[j];    /* copy old text after ep */  for( j=ep; j<wtext->text.length; j++,i++ )    newTxt[i] = wtext->text.txt[j];    newTxt[i] = '\0';    /* By default No text is selected, and the cursor is at the end   * of inserted text */  wtext->text.startPos = sp+txtLen;  wtext->text.endPos   = sp+txtLen;    free(wtext->text.txt);  wtext->text.txt    = newTxt;  wtext->text.length = newLen-1;  }