summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2021-01-20 12:53:15 +0100
committerSusant Sahani <ssahani@vmware.com>2021-01-20 15:09:09 +0100
commit32ae5db60a7d4a42b9449e7de630b5e2b6b44ee9 (patch)
treee29150a30d927d0f64e72677182be6e58dee12e2
parent9a8d1b455b80385342ebed20be839f5ca5c8f15b (diff)
downloadsystemd-32ae5db60a7d4a42b9449e7de630b5e2b6b44ee9.tar.gz
machine: Use hashmap_ensure_put
-rw-r--r--src/machine/image-dbus.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c
index 4c4f900527..f74cabd7fb 100644
--- a/src/machine/image-dbus.c
+++ b/src/machine/image-dbus.c
@@ -390,10 +390,6 @@ static int image_object_find(sd_bus *bus, const char *path, const char *interfac
return 1;
}
- r = hashmap_ensure_allocated(&m->image_cache, &image_hash_ops);
- if (r < 0)
- return r;
-
if (!m->image_cache_defer_event) {
r = sd_event_add_defer(m->event, &m->image_cache_defer_event, image_flush_cache, m);
if (r < 0)
@@ -416,7 +412,7 @@ static int image_object_find(sd_bus *bus, const char *path, const char *interfac
image->userdata = m;
- r = hashmap_put(m->image_cache, image->name, image);
+ r = hashmap_ensure_put(&m->image_cache, &image_hash_ops, image->name, image);
if (r < 0) {
image_unref(image);
return r;