Fix leak in tm