Skip to content

Commit

Permalink
clar: fix leaking error reports
Browse files Browse the repository at this point in the history
We never free error reports when some of the tests have failed or issued
warnings. Plug this memory leak.
  • Loading branch information
pks-t committed Oct 21, 2024
1 parent 15580f9 commit f6b6476
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clar.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,14 @@ clar_test_shutdown(void)
}

for (report = _clar.reports; report; report = report_next) {
struct clar_error *error, *error_next;

for (error = report->errors; error; error = error_next) {
free(error->description);
error_next = error->next;
free(error);
}

report_next = report->next;
free(report);
}
Expand Down

0 comments on commit f6b6476

Please sign in to comment.