]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: load fragment - use hashmap_ensure_put
authorSusant Sahani <ssahani@vmware.com>
Sun, 17 Jan 2021 08:55:00 +0000 (09:55 +0100)
committerSusant Sahani <ssahani@vmware.com>
Sun, 17 Jan 2021 13:24:41 +0000 (14:24 +0100)
src/core/load-fragment.c

index 4401e598b5ce2dd3c80fd66db21ce2011014fb6d..494c7f55a7d87d5eb912ce9da945349d62dc2e82 100644 (file)
@@ -4536,14 +4536,12 @@ int config_parse_set_credential(
                 sc->data = TAKE_PTR(unescaped);
                 sc->size = l;
 
-                r = hashmap_ensure_allocated(&context->set_credentials, &exec_set_credential_hash_ops);
+                r = hashmap_ensure_put(&context->set_credentials, &exec_set_credential_hash_ops, sc->id, sc);
+                if (r == -ENOMEM)
+                        return log_oom();
                 if (r < 0)
                         return r;
 
-                r = hashmap_put(context->set_credentials, sc->id, sc);
-                if (r < 0)
-                        return log_oom();
-
                 TAKE_PTR(sc);
         }