Fixing small memory leaks (Hans)