Fix memory leak shown in memory-test-8.hs and memory-test-8a.hs.