summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/unit.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 730492e226..496db6c4cd 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -3643,11 +3643,9 @@ int unit_require_mounts_for(Unit *u, const char *path) {
if (!x) {
char *q;
- if (!u->manager->units_requiring_mounts_for) {
- u->manager->units_requiring_mounts_for = hashmap_new(&string_hash_ops);
- if (!u->manager->units_requiring_mounts_for)
- return -ENOMEM;
- }
+ r = hashmap_ensure_allocated(&u->manager->units_requiring_mounts_for, &string_hash_ops);
+ if (r < 0)
+ return r;
q = strdup(prefix);
if (!q)