Fixed memory leak in text.cpp