fix memory leak

This commit is contained in:
John Jones 2018-03-08 10:46:23 -05:00
parent 43b81cb69b
commit 2017ed911a

View file

@ -217,18 +217,16 @@ void cli::getline( const fc::string& prompt, fc::string& line)
if( line_read == nullptr ) if( line_read == nullptr )
FC_THROW_EXCEPTION( fc::eof_exception, "" ); FC_THROW_EXCEPTION( fc::eof_exception, "" );
line = line_read; line = line_read;
if (*line_read) try
{ {
try if (*line_read)
{
add_history(line_read); add_history(line_read);
free(line_read); free(line_read);
} }
catch(...) catch(...)
{ {
free(line_read); free(line_read);
throw; throw;
}
} }
}).wait(); }).wait();
} }