fix memory leakage in openfpga title

This commit is contained in:
tangxifan 2020-04-07 16:14:41 -06:00
parent 6daee8c2c8
commit 5a04da2082
3 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@
* Generate a string of openfpga title introduction
* This is mainly used when launching OpenFPGA shell
*******************************************************************/
const char* create_openfpga_title() {
std::string create_openfpga_title() {
std::string title;
title += std::string("\n");
@ -49,5 +49,5 @@ const char* create_openfpga_title() {
title += std::string("THE SOFTWARE.\n");
title += std::string("\n");
return title.c_str();
return title;
}

View File

@ -9,6 +9,6 @@
/********************************************************************
* Function declaration
*******************************************************************/
const char* create_openfpga_title();
std::string create_openfpga_title();
#endif

View File

@ -48,7 +48,7 @@ int main(int argc, char** argv) {
*/
openfpga::Shell<OpenfpgaContext> shell("OpenFPGA");
shell.add_title(create_openfpga_title());
shell.add_title(create_openfpga_title().c_str());
/* Add vpr commands */
openfpga::add_vpr_commands(shell);