Fix potential memory leak (cycle)