Plug a memory leak in tests