Fixed memory leak on xterm