Fix memleak in FunctionCallScheduler::removeFunction