mirror of
https://github.com/serge1/ELFIO.git
synced 2024-12-26 09:14:29 +00:00
Fix possible nullptr dereference
This commit is contained in:
parent
2a029fe589
commit
e656f75767
@ -138,8 +138,12 @@ class elfio
|
|||||||
bool load( const std::string& file_name, bool is_lazy = false )
|
bool load( const std::string& file_name, bool is_lazy = false )
|
||||||
{
|
{
|
||||||
pstream = std::make_unique<std::ifstream>();
|
pstream = std::make_unique<std::ifstream>();
|
||||||
|
if ( !pstream ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pstream->open( file_name.c_str(), std::ios::in | std::ios::binary );
|
pstream->open( file_name.c_str(), std::ios::in | std::ios::binary );
|
||||||
if ( pstream == nullptr || !*pstream ) {
|
if ( !*pstream ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user