From: Susant Sahani Date: Wed, 20 Jan 2021 11:29:08 +0000 (+0100) Subject: Journal: Use hashmap_ensure_put X-Git-Tag: v248-rc1~286^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=faa7e5a43b857bc278d1a3038f5b1954e537cbb0;p=thirdparty%2Fsystemd.git Journal: Use hashmap_ensure_put --- diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index 27251a25970..46b1cba1452 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -80,10 +80,6 @@ static int journal_put_error(sd_journal *j, int r, const char *path) { if (r >= 0) return r; - k = hashmap_ensure_allocated(&j->errors, NULL); - if (k < 0) - return k; - if (path) { copy = strdup(path); if (!copy) @@ -91,7 +87,7 @@ static int journal_put_error(sd_journal *j, int r, const char *path) { } else copy = NULL; - k = hashmap_put(j->errors, INT_TO_PTR(r), copy); + k = hashmap_ensure_put(&j->errors, NULL, INT_TO_PTR(r), copy); if (k < 0) { free(copy);