coverity: fix memory leak
coverity: uncaught exception
impl. XML format detection