Fix memory leak reported by Coverity