[1.2.4] Fix memory leaks