Memory leak fix in SchedulerTest