Memory leak - fixes #2255