Fix memory leak when serial monitor autoscroll is disabled