summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/binfmt.c2
-rw-r--r--src/conf-parser.c2
-rw-r--r--src/install.c1
-rw-r--r--src/load-fragment.c1
-rw-r--r--src/localed.c3
-rw-r--r--src/logind-dbus.c4
-rw-r--r--src/modules-load.c1
-rw-r--r--src/path.c2
-rw-r--r--src/sd-login.c4
-rw-r--r--src/service.c2
-rw-r--r--src/socket.c2
-rw-r--r--src/strv.c17
-rw-r--r--src/systemctl.c1
-rw-r--r--src/timedated.c2
-rw-r--r--src/util.c5
15 files changed, 36 insertions, 13 deletions
diff --git a/src/binfmt.c b/src/binfmt.c
index 552d8cc227..e8d6524391 100644
--- a/src/binfmt.c
+++ b/src/binfmt.c
@@ -33,7 +33,7 @@
#include "util.h"
static int delete_rule(const char *rule) {
- char *x, *fn, *e;
+ char *x, *fn = NULL, *e;
int r;
assert(rule[0]);
diff --git a/src/conf-parser.c b/src/conf-parser.c
index 3bb430e375..a71dcd0d8f 100644
--- a/src/conf-parser.c
+++ b/src/conf-parser.c
@@ -314,7 +314,7 @@ int config_parse(
continuation = c;
else {
continuation = strdup(l);
- if (!c) {
+ if (!continuation) {
r = -ENOMEM;
goto finish;
}
diff --git a/src/install.c b/src/install.c
index 7443973502..53dd26fd7f 100644
--- a/src/install.c
+++ b/src/install.c
@@ -479,7 +479,6 @@ static int find_symlinks_fd(
t = path_make_absolute(name, config_path);
if (!t) {
free(p);
- free(dest);
r = -ENOMEM;
break;
}
diff --git a/src/load-fragment.c b/src/load-fragment.c
index c7d2da34b4..12079c640f 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -554,6 +554,7 @@ int config_parse_exec(
if (!n[0]) {
log_error("[%s:%u] Invalid command line, ignoring: %s", filename, line, rvalue);
strv_free(n);
+ free(path);
return 0;
}
diff --git a/src/localed.c b/src/localed.c
index f652110db4..fbb5a41d1a 100644
--- a/src/localed.c
+++ b/src/localed.c
@@ -215,6 +215,7 @@ static int write_data(void) {
}
if (strv_isempty(l)) {
+ strv_free(l);
if (unlink("/etc/locale.conf") < 0)
return errno == ENOENT ? 0 : -errno;
@@ -459,6 +460,8 @@ static DBusHandlerResult locale_message_handler(
}
}
+ strv_free(l);
+
for (p = 0; p < _PROP_MAX; p++) {
if (passed[p])
continue;
diff --git a/src/logind-dbus.c b/src/logind-dbus.c
index b8f7d6718b..b33a096f3c 100644
--- a/src/logind-dbus.c
+++ b/src/logind-dbus.c
@@ -381,6 +381,7 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
session = hashmap_get(m->sessions, id);
if (session) {
+ free(id);
fifo_fd = session_create_fifo(session);
if (fifo_fd < 0) {
@@ -421,6 +422,9 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
close_nointr_nofail(fifo_fd);
*_reply = reply;
+ strv_free(controllers);
+ strv_free(reset_controllers);
+
return 0;
}
diff --git a/src/modules-load.c b/src/modules-load.c
index 17b5e0bf80..8dd98f73d8 100644
--- a/src/modules-load.c
+++ b/src/modules-load.c
@@ -77,7 +77,6 @@ int main(int argc, char *argv[]) {
continue;
log_error("Failed to open %s: %m", *fn);
- free(fn);
r = EXIT_FAILURE;
continue;
}
diff --git a/src/path.c b/src/path.c
index 1d4aa2174a..f15c9214ef 100644
--- a/src/path.c
+++ b/src/path.c
@@ -563,7 +563,7 @@ static void path_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
assert(l > 0);
if (!(buf = malloc(l))) {
- log_error("Failed to allocate buffer: %s", strerror(-ENOMEM));
+ log_error("Failed to allocate buffer: %s", strerror(ENOMEM));
goto fail;
}
diff --git a/src/sd-login.c b/src/sd-login.c
index 2489d78c60..b670d18266 100644
--- a/src/sd-login.c
+++ b/src/sd-login.c
@@ -499,6 +499,7 @@ _public_ int sd_seat_get_sessions(const char *seat, char ***sessions, uid_t **ui
if (!k) {
free(t);
free(b);
+ strv_free(a);
return -ENOMEM;
}
@@ -574,6 +575,9 @@ _public_ int sd_get_uids(uid_t **users) {
uid_t *l = NULL;
d = opendir("/run/systemd/users/");
+ if (!d)
+ return -errno;
+
for (;;) {
struct dirent buffer, *de;
int k;
diff --git a/src/service.c b/src/service.c
index 2b45ecb715..2ae8785ac4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3115,7 +3115,7 @@ static int service_enumerate(Manager *m) {
free(fpath);
fpath = join(path, "/", de->d_name, NULL);
- if (!path) {
+ if (!fpath) {
r = -ENOMEM;
goto finish;
}
diff --git a/src/socket.c b/src/socket.c
index 572e622011..a1b451eba0 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -844,7 +844,7 @@ static int mq_address_create(
fd = mq_open(path, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_CREAT, mq_mode, attr);
umask(old_mask);
- if (fd < 0 && errno != EEXIST) {
+ if (fd < 0) {
r = -errno;
goto fail;
}
diff --git a/src/strv.c b/src/strv.c
index 92851b2233..640ae3f0a3 100644
--- a/src/strv.c
+++ b/src/strv.c
@@ -201,12 +201,19 @@ char **strv_merge_concat(char **a, char **b, const char *suffix) {
if (!(r = new(char*, strv_length(a)+strv_length(b)+1)))
return NULL;
- for (k = r; *a; k++, a++)
- if (!(*k = strdup(*a)))
- goto fail;
- for (; *b; k++, b++)
- if (!(*k = strappend(*b, suffix)))
+ k = r;
+ if (a)
+ for (; *a; k++, a++) {
+ *k = strdup(*a);
+ if (!*k)
+ goto fail;
+ }
+
+ for (; *b; k++, b++) {
+ *k = strappend(*b, suffix);
+ if (!*k)
goto fail;
+ }
*k = NULL;
return r;
diff --git a/src/systemctl.c b/src/systemctl.c
index 7caeb6dd91..e85a2fd44c 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -608,6 +608,7 @@ static int list_unit_files(DBusConnection *bus, char **args) {
r = unit_file_get_list(arg_scope, arg_root, h);
if (r < 0) {
+ unit_file_list_free(h);
log_error("Failed to get unit file list: %s", strerror(-r));
return r;
}
diff --git a/src/timedated.c b/src/timedated.c
index 66e50a6868..f6fe2d83b6 100644
--- a/src/timedated.c
+++ b/src/timedated.c
@@ -246,7 +246,7 @@ static int write_data_local_rtc(void) {
p++;
e = strchr(p, '\n');
- if (!p) {
+ if (!e) {
free(s);
return -EIO;
}
diff --git a/src/util.c b/src/util.c
index 6033aa05b2..6a9fffbf3d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -5529,6 +5529,9 @@ int get_files_in_directory(const char *path, char ***list) {
* number */
d = opendir(path);
+ if (!d)
+ return -errno;
+
for (;;) {
struct dirent buffer, *de;
int k;
@@ -5629,6 +5632,8 @@ char *join(const char *x, ...) {
p = stpcpy(p, t);
}
+
+ va_end(ap);
} else
r[0] = 0;