#624 Remove invalid delete in empty rec_buffer, checkpoint load no longer crashes.

This commit is contained in:
Scott Fennell 2018-07-09 09:23:28 -05:00
parent 398907f365
commit a0eaf5b794

View File

@ -286,15 +286,18 @@ void Trick::DataRecordGroup::remove_variable( std::string in_name ) {
void Trick::DataRecordGroup::remove_all_variables() {
// remove all but the first variable, which is sim time
if(!rec_buffer.empty()) {
for (auto i = rec_buffer.begin() + 1; i != rec_buffer.end(); ++i) {
delete *i;
}
rec_buffer.erase(rec_buffer.begin() + 1, rec_buffer.end());
}
// remove everything
for (auto variable : change_buffer) {
delete variable;
}
change_buffer.clear();
}
@ -716,8 +719,10 @@ int Trick::DataRecordGroup::shutdown() {
remove_all_variables();
// remove_all_variables does not remove sim time
if(!rec_buffer.empty()){
delete rec_buffer[0];
rec_buffer.clear();
}
if ( writer_buff ) {
free(writer_buff) ;