diff --git a/paddle/contrib/inference/paddle_inference_api_impl.cc b/paddle/contrib/inference/paddle_inference_api_impl.cc index 349bd3b40368956dd9656ce7f062525f2612e5c1..bf510620eb139f7fe701a3d52e70f86ddb3b8ede 100644 --- a/paddle/contrib/inference/paddle_inference_api_impl.cc +++ b/paddle/contrib/inference/paddle_inference_api_impl.cc @@ -135,10 +135,11 @@ bool PaddlePredictorImpl::Run(const std::vector &inputs, std::unique_ptr PaddlePredictorImpl::Clone() { VLOG(3) << "Predictor::clone"; - std::unique_ptr cls(new PaddlePredictorImpl(config_)); + std::unique_ptr cls(nullptr); if (!cls->InitShared()) { LOG(ERROR) << "fail to call InitShared"; - return nullptr; + } else { + cls.reset(new PaddlePredictorImpl(config_)); } // fix manylinux compile error. return cls;