Skip to content

Commit

Permalink
Merge pull request #27 from lxylxy123456/hire_assistant
Browse files Browse the repository at this point in the history
Fix memory leak in src/HireAssistantTest.cpp
  • Loading branch information
lxylxy123456 committed Dec 17, 2020
2 parents 3af51bb + 816858e commit 5d05385
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ VALGRIND := $(filter-out valgrind/RaceExampleTest,$(VALGRIND))
# VALGRIND_ALL has currently unavailable tests filtered out
VALGRIND_ALL := $(VALGRIND)
VALGRIND_ALL := $(filter-out valgrind/FibTest,$(VALGRIND_ALL))
VALGRIND_ALL := $(filter-out valgrind/HireAssistantTest,$(VALGRIND_ALL))
VALGRIND_ALL := $(filter-out valgrind/HuffmanTest,$(VALGRIND_ALL))
VALGRIND_ALL := $(filter-out valgrind/IntervalTreeTest,$(VALGRIND_ALL))
VALGRIND_ALL := $(filter-out valgrind/MatVecTest,$(VALGRIND_ALL))
Expand Down
3 changes: 3 additions & 0 deletions src/HireAssistantMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ int main(int argc, char *argv[]) {
candidates.push_back(new Candidate<int>(*i, ci, ch, false));
output_integers(abilities);
std::cout << HireAssistant(candidates) << std::endl;
for (std::vector<Candidate<int>*>::iterator i = candidates.begin();
i < candidates.end(); i++)
delete *i;
return 0;
}
3 changes: 3 additions & 0 deletions src/HireAssistantTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ int test(int n, int ci, int ch) {
assert(ans > 0);
else
assert(ans == 0);
for (std::vector<Candidate<int>*>::iterator i = candidates.begin();
i < candidates.end(); i++)
delete *i;
return 0;
}

Expand Down

0 comments on commit 5d05385

Please sign in to comment.