Memory leak on Linux fixed