mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Fix potential null pointer dereference
This commit is contained in:
parent
66bd80703e
commit
33d5f0c8dd
@ -56,6 +56,12 @@ struct ReadBufferFromHDFS::ReadBufferFromHDFSImpl
|
||||
}
|
||||
|
||||
fin = hdfsOpenFile(fs, path.c_str(), O_RDONLY, 0, 0, 0);
|
||||
|
||||
if (fin == nullptr)
|
||||
{
|
||||
throw Exception("Unable to open HDFS file: " + path + " error: " + std::string(hdfsGetLastError()),
|
||||
ErrorCodes::NETWORK_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
~ReadBufferFromHDFSImpl()
|
||||
|
@ -60,6 +60,12 @@ struct WriteBufferFromHDFS::WriteBufferFromHDFSImpl
|
||||
}
|
||||
|
||||
fout = hdfsOpenFile(fs, path.c_str(), O_WRONLY, 0, 0, 0);
|
||||
if (fout == nullptr)
|
||||
{
|
||||
throw Exception("Unable to open HDFS file: " + path + " error: " + std::string(hdfsGetLastError()),
|
||||
ErrorCodes::NETWORK_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
~WriteBufferFromHDFSImpl()
|
||||
|
Loading…
Reference in New Issue
Block a user