correction of valgrin error

This commit is contained in:
hugogogo
2022-06-16 18:48:46 +02:00
parent 5ee4202020
commit e3151bce4e
3 changed files with 22 additions and 5 deletions

View File

@@ -47,7 +47,7 @@ std::ostream & operator<<(std::ostream & o, mystruct const * rhs) {
// ************************************
extern std::vector<A_test*> test_list;
extern void add_to_list(std::string s, A_test* s1, A_test* s2, A_test* s3, A_test* s4);
std::vector<mystruct*> mem_list_struct;
std::vector<mystruct*> mem_list;
// adding each test to the list
@@ -101,7 +101,7 @@ template <>
mystruct* val(int n) {
mystruct *s = new mystruct(n);
mem_list_struct.push_back(s);
mem_list.push_back(s);
return ( s );
}
@@ -126,10 +126,11 @@ template <class T>
void delete_structs() {
std::vector<mystruct*>::iterator it;
std::vector<mystruct*>::iterator it_end = mem_list_struct.end();
std::vector<mystruct*>::iterator it_end = mem_list.end();
for (it = mem_list_struct.begin(); it != it_end; ++it)
for (it = mem_list.begin(); it != it_end; ++it)
delete *it;
mem_list.clear();
}