Merge pull request #235 from pi-hole/fix/wildcarddomains_not_NULL

Test for wildcarddomains == NULL in flush.c
This commit is contained in:
DL6ER
2018-02-17 17:44:20 +01:00
committed by GitHub
2 changed files with 15 additions and 5 deletions
+9 -5
View File
@@ -54,13 +54,17 @@ void pihole_log_flushed(bool message)
memory.domainnames = 0;
// wildcarddomains struct: Free allocated substructure
for(i=0;i<counters.wildcarddomains;i++)
// Do this only when we actually imported wildcards
if(wildcarddomains != NULL)
{
free(wildcarddomains[i]);
for(i=0;i<counters.wildcarddomains;i++)
{
free(wildcarddomains[i]);
}
free(wildcarddomains);
wildcarddomains = NULL;
memory.wildcarddomains = 0;
}
free(wildcarddomains);
wildcarddomains = NULL;
memory.wildcarddomains = 0;
// overTime struct: Free allocated substructure
for(i=0;i<counters.overTime;i++)
+6
View File
@@ -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[@]}"