patching a memory leak