Skip to content
Snippets Groups Projects
Commit a8a26709 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

scan-build: fix possible leaks

parent f1e0cd82
No related branches found
No related tags found
No related merge requests found
......@@ -154,6 +154,7 @@ int main(int argc, char **argv)
verbose = 1;
break;
case 'V':
free(config_fn);
printf("%s, version %s\n", "Knot DNS", PACKAGE_VERSION);
return 0;
case 'h':
......@@ -308,10 +309,15 @@ int main(int argc, char **argv)
return do_cleanup(server, config_fn, pidf);
log_server_info("Server started as a daemon, PID = %ld\n", pid);
log_server_info("PID stored in '%s'\n", pidf);
if ((cwd = malloc(PATH_MAX)) != NULL)
cwd = getcwd(cwd, PATH_MAX);
if (chdir("/") != 0)
if ((cwd = malloc(PATH_MAX)) != NULL) {
if (getcwd(cwd, PATH_MAX) == NULL) {
log_server_info("Cannot get current working directory.\n");
cwd[0] = '\0';
}
}
if (chdir("/") != 0) {
log_server_warning("Server can't change working directory.\n");
}
} else {
log_server_info("Server started in foreground, PID = %ld\n", pid);
log_server_info("Server running without PID file.\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment