Some minor cleaning up [ci skip].
Fixed a small memory leak [ci skip].