Commit 76ccbb9f authored by Daniel Salzman's avatar Daniel Salzman

config: fix possible resource leaks (coverity)

parent 0b49689c
......@@ -129,7 +129,8 @@ int conf_new(
lmdb_opts.path = mkdtemp(tpl);
if (lmdb_opts.path == NULL) {
log_error("failed to create temporary directory");
return EXIT_FAILURE;
ret = KNOT_ENOMEM;
goto new_error;
}
} else {
lmdb_opts.path = db_dir;
......
......@@ -264,6 +264,7 @@ int include_file(
fpathconf(dirfd(dir), _PC_NAME_MAX) + 1;
struct dirent *entry = malloc(len);
if (entry == NULL) {
free(path);
return KNOT_ENOMEM;
}
memset(entry, 0, len);
......
......@@ -45,10 +45,10 @@ char* pid_filename()
char *rundir = conf_abs_path(&val, NULL);
val = conf_get(conf(), C_SRV, C_PIDFILE);
char *pidfile = conf_abs_path(&val, rundir);
free(rundir);
rcu_read_unlock();
if (rundir != NULL) {
free(rundir);
return pidfile;
} else {
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment