summaryrefslogtreecommitdiffstats
path: root/src/udev/udevd.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-12-18 06:49:17 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-01-12 01:32:20 +0100
commit1f3f6bd0078b9d76d5ed72b74b890ca5e3a1756c (patch)
tree61d5d2b5844a497a2386e02152fc5eb4f1511b3e /src/udev/udevd.c
parentsd-device-monitor: fix ordering of setting buffer size (diff)
downloadsystemd-1f3f6bd0078b9d76d5ed72b74b890ca5e3a1756c.tar.xz
systemd-1f3f6bd0078b9d76d5ed72b74b890ca5e3a1756c.zip
udevd: use worker_free() on failure in worker_new()
Otherwise, worker_monitor may not unrefed correctly.
Diffstat (limited to '')
-rw-r--r--src/udev/udevd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 697506feaf..33fc0b3c2c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -186,6 +186,8 @@ static void worker_free(struct worker *worker) {
free(worker);
}
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct worker *, worker_free);
+
static void manager_workers_free(Manager *manager) {
struct worker *worker;
Iterator i;
@@ -199,7 +201,7 @@ static void manager_workers_free(Manager *manager) {
}
static int worker_new(struct worker **ret, Manager *manager, sd_device_monitor *worker_monitor, pid_t pid) {
- _cleanup_free_ struct worker *worker = NULL;
+ _cleanup_(worker_freep) struct worker *worker = NULL;
int r;
assert(ret);