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 Sep 20, 2024
1 parent e088b4d commit 0b2e5a7
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 @@ -612,6 +612,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 0b2e5a7

Please sign in to comment.