projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aac6673
)
journal: context - Use _cleanup_free_
author
Susant Sahani
<ssahani@vmware.com>
Mon, 18 Jan 2021 11:13:51 +0000
(12:13 +0100)
committer
Susant Sahani
<ssahani@vmware.com>
Mon, 18 Jan 2021 11:13:51 +0000
(12:13 +0100)
src/journal/journald-context.c
patch
|
blob
|
history
diff --git
a/src/journal/journald-context.c
b/src/journal/journald-context.c
index 8736495a4bdfb1eee441826413643e9a35756960..577d5254c5c88d724bcf5d939b5db4387db67380 100644
(file)
--- 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;
}