1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

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.
This commit is contained in:
Lennart Poettering 2018-12-10 19:38:38 +01:00
parent 4a53080be6
commit 48235ad6b7

View File

@ -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;
}