Fix memory leak with node->last_input