fixed memleak in a test