NULL check after malloc

This commit is contained in:
Scott Giese
2021-02-13 22:25:31 -06:00
parent 469a28c49a
commit d1509d6096
3 changed files with 14 additions and 8 deletions
+6 -4
View File
@@ -339,10 +339,12 @@ int main(int argc, char **argv) {
char *home = getenv("HOME");
if (!home) home = ".";
path = malloc(strlen(home) + 1 + sizeof(".rblcheckrc"));
sprintf(path, "%s/.rblcheckrc", home);
if (!addzonefile(path))
addzonefile("/etc/rblcheckrc");
free(path);
if (path) {
sprintf(path, "%s/.rblcheckrc", home);
if (!addzonefile(path))
addzonefile("/etc/rblcheckrc");
free(path);
}
}
}
if (!nzones)