Close input stream too

This commit is contained in:
Ryan Lai 2020-07-20 19:32:34 -07:00
parent 846e550c4f
commit 4564776733

View file

@ -65,7 +65,7 @@ bool ProtobufHelpers::LoadOnnxTensorFromProtobufFile(onnx::TensorProto& tensor,
google::protobuf::io::FileInputStream input(fd, block_size);
const bool result = tensor.ParseFromZeroCopyStream(&input) && input.GetErrno() == 0;
status = onnxruntime::Env::Default().FileClose(fd);
if (!result || !status.IsOK()) {
if (!result || !status.IsOK() || !input.Close()) {
return false;
}
return true;