From 48235ad6b7ef168e029d48701a08b62b616bcdd2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 10 Dec 2018 19:38:38 +0100 Subject: [PATCH] job: be more careful when removing job object from jobs hash table Let's validate that the ID is actually allocated to us before remove a job. This is relevant as various bits of code will call job_free() on partially set up Job objects, and we really shouldn't remove another job object accidentally from the hash table, when the set up didn't complete. --- src/core/job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/job.c b/src/core/job.c index 7fa3673..8106a78 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -151,7 +151,7 @@ void job_uninstall(Job *j) { unit_add_to_gc_queue(j->unit); - hashmap_remove(j->manager->jobs, UINT32_TO_PTR(j->id)); + hashmap_remove_value(j->manager->jobs, UINT32_TO_PTR(j->id), j); j->installed = false; } -- 2.7.4