Skip to content

Commit e656f75

Browse files
saveasguyserge1
authored andcommitted
Fix possible nullptr dereference
1 parent 2a029fe commit e656f75

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elfio/elfio.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,12 @@ class elfio
138138
bool load( const std::string& file_name, bool is_lazy = false )
139139
{
140140
pstream = std::make_unique<std::ifstream>();
141+
if ( !pstream ) {
142+
return false;
143+
}
144+
141145
pstream->open( file_name.c_str(), std::ios::in | std::ios::binary );
142-
if ( pstream == nullptr || !*pstream ) {
146+
if ( !*pstream ) {
143147
return false;
144148
}
145149

0 commit comments

Comments
 (0)