assuring that malloc gets freed

This commit is contained in:
John Jones 2018-03-08 07:40:20 -05:00
parent 5b5190a55c
commit 43b81cb69b

View file

@ -216,10 +216,20 @@ void cli::getline( const fc::string& prompt, fc::string& line)
line_read = readline(prompt.c_str());
if( line_read == nullptr )
FC_THROW_EXCEPTION( fc::eof_exception, "" );
if( *line_read )
add_history(line_read);
line = line_read;
free(line_read);
if (*line_read)
{
try
{
add_history(line_read);
free(line_read);
}
catch(...)
{
free(line_read);
throw;
}
}
}).wait();
}
else