Now it seems that all memory leaks has been solved; removed TODO.