Skip to content

Commit

Permalink
Fix possible nullptr dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
saveasguy authored and serge1 committed Nov 6, 2024
1 parent 2a029fe commit e656f75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion elfio/elfio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ class elfio
bool load( const std::string& file_name, bool is_lazy = false )
{
pstream = std::make_unique<std::ifstream>();
if ( !pstream ) {
return false;
}

pstream->open( file_name.c_str(), std::ios::in | std::ios::binary );
if ( pstream == nullptr || !*pstream ) {
if ( !*pstream ) {
return false;
}

Expand Down

0 comments on commit e656f75

Please sign in to comment.