Fix a memory leak. Found by both scan-build and coverity. Close CID 1096442