added fix-memory-leaks.diff patch