free memory leaks MonteVarFile.cpp

This commit is contained in:
Scott Fennell 2018-10-01 13:24:37 -05:00
parent 7b3b47aa39
commit 2cdd4bf380

View File

@ -77,6 +77,9 @@ std::string Trick::MonteVarFile::get_next_value() {
}
// Get the next value.
if(temp_str) {
free(temp_str);
}
temp_str = strdup(line.c_str());
token = strtok(temp_str, " \t");
@ -97,6 +100,10 @@ std::string Trick::MonteVarFile::get_next_value() {
return ss.str();
}
if(temp_str) {
free(temp_str);
temp_str = nullptr;
}
char string[100];
sprintf(string, "Trick:MonteVarFile the input file \"%s\" is not open for reading", file_name.c_str());
exec_terminate_with_return(-1, __FILE__, __LINE__, string);