Fixed memory leak in dot.