Applying fix for memory leak in ReOrient function.