From 7b04e25a2513b768db0918e22217ee0b997f1af9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 17 Feb 2018 13:11:38 +0100 Subject: [PATCH 1/2] Check for wildcarddomains != NULL before freeing them in pihole_log_flush() Signed-off-by: DL6ER --- flush.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/flush.c b/flush.c index 6ed79a81..39e3e825 100644 --- a/flush.c +++ b/flush.c @@ -54,13 +54,17 @@ void pihole_log_flushed(bool message) memory.domainnames = 0; // wildcarddomains struct: Free allocated substructure - for(i=0;i Date: Sat, 17 Feb 2018 13:24:31 +0100 Subject: [PATCH 2/2] Add test that no "FATAL" lines have been found in the log Signed-off-by: DL6ER --- test/test_suite.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_suite.sh b/test/test_suite.sh index 8fcd85af..de29f274 100644 --- a/test/test_suite.sh +++ b/test/test_suite.sh @@ -238,6 +238,12 @@ load 'libs/bats-support/load' [[ ${lines[2]} == "d2 ff ff ff ff d2 00 00 00 07 d2 00 00 00 02 ca 41 e4 92 49 d2 00 00 00 06 d2 00 00 00 03 d2 00 00 00 02 d2 00 00 00 03 d2 00 00 00 03 cc 02 c1 " ]] } +@test "Verify no FATAL warnings are present in the generated log" { + run bash -c 'grep -c "FATAL" pihole-FTL.log' + echo "output: ${lines[@]}" + [[ ${lines[0]} == "0" ]] +} + @test "Final part of the tests: Killing pihole-FTL process" { run bash -c 'echo ">kill" | nc -v 127.0.0.1 4711' echo "output: ${lines[@]}"