From 93f0fff49d45d0cb36d7f7d9109c4fb56e6ebeab Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sun, 23 Jul 2023 13:15:16 -0400 Subject: [PATCH] Free working memory in crossparse test. When reading from a file, the getline buffer is not explicitly freed by the test application, which shows up as leaked memory in memory debugging tools. Let's fix that so we don't mistake that for an actual leak in the library. --- t/crossparse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/crossparse.c b/t/crossparse.c index e19b438..520b08a 100644 --- a/t/crossparse.c +++ b/t/crossparse.c @@ -1,6 +1,6 @@ /* * Test that libcdecl can parse its own output. - * Copyright © 2012, 2020 Nick Bowler + * Copyright © 2012, 2020, 2022-2023 Nick Bowler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -190,6 +190,9 @@ int main(int argc, char **argv) if (!test_crossparse(line, mode)) ret = EXIT_FAILURE; } + + free(line); + fclose(infile); } else if (argv[optind]) { for (int i = optind; i < argc; i++) { if (!test_crossparse(argv[i], mode)) -- 2.43.2