updated MemoryLeak code matches c-style better