summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-manager.c6
-rw-r--r--src/core/load-fragment.c6
-rw-r--r--src/core/manager.c6
-rw-r--r--src/core/mount-setup.c3
4 files changed, 7 insertions, 14 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index d767dd5236..1f5a7d94fd 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -1186,11 +1186,9 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
if (!client)
goto oom;
- r = set_put(s, client);
- if (r < 0) {
- free(client);
+ r = set_consume(s, client);
+ if (r < 0)
return bus_send_error_reply(connection, message, NULL, r);
- }
reply = dbus_message_new_method_return(message);
if (!reply)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0571d517b0..3d23372630 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2095,11 +2095,9 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
if (!id)
return -ENOMEM;
- r = set_put(names, id);
- if (r < 0) {
- free(id);
+ r = set_consume(names, id);
+ if (r < 0)
return r;
- }
}
}
diff --git a/src/core/manager.c b/src/core/manager.c
index 208b240ba1..b1a22890fb 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -806,11 +806,9 @@ static void manager_build_unit_path_cache(Manager *m) {
goto fail;
}
- r = set_put(m->unit_path_cache, p);
- if (r < 0) {
- free(p);
+ r = set_consume(m->unit_path_cache, p);
+ if (r < 0)
goto fail;
- }
}
closedir(d);
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index 89adb0b4a3..b841f478c3 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -251,10 +251,9 @@ int mount_cgroup_controllers(char ***join_controllers) {
continue;
}
- r = set_put(controllers, controller);
+ r = set_consume(controllers, controller);
if (r < 0) {
log_error("Failed to add controller to set.");
- free(controller);
goto finish;
}
}