summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@vmware.com>2021-01-18 12:13:51 +0100
committerSusant Sahani <ssahani@vmware.com>2021-01-18 12:13:51 +0100
commit08ff6fcffb6fdfc220ebbba5dd60843a0fc71393 (patch)
treef750535e295b92ecfbe32b96ce06290208bed7f0 /src/journal
parentaac6673f026229bdad3f57758560b1de186b043c (diff)
downloadsystemd-08ff6fcffb6fdfc220ebbba5dd60843a0fc71393.tar.gz
journal: context - Use _cleanup_free_
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-context.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/journal/journald-context.c b/src/journal/journald-context.c
index 8736495a4b..577d5254c5 100644
--- a/src/journal/journald-context.c
+++ b/src/journal/journald-context.c
@@ -102,7 +102,7 @@ static int client_context_compare(const void *a, const void *b) {
}
static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
- ClientContext *c;
+ _cleanup_free_ ClientContext *c = NULL;
int r;
assert(s);
@@ -137,12 +137,10 @@ static int client_context_new(Server *s, pid_t pid, ClientContext **ret) {
};
r = hashmap_put(s->client_contexts, PID_TO_PTR(pid), c);
- if (r < 0) {
- free(c);
+ if (r < 0)
return r;
- }
- *ret = c;
+ *ret = TAKE_PTR(c);
return 0;
}