summaryrefslogtreecommitdiff
path: root/src/oom/oomd-util.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-03-08 10:35:31 -0800
committerAnita Zhang <the.anitazha@gmail.com>2021-03-08 14:37:15 -0800
commit45da27fa053898c1b94c175070a0dd63128875c9 (patch)
tree15f4c4bfb2c498abc6f455012563fe48893e72bb /src/oom/oomd-util.c
parent399d80ba8c604d57e7df6c5118ea3258cce026d9 (diff)
downloadsystemd-45da27fa053898c1b94c175070a0dd63128875c9.tar.gz
oomd: move TAKE_PTR to end of oomd_insert_cgroup_context()
Fixes #18926
Diffstat (limited to 'src/oom/oomd-util.c')
-rw-r--r--src/oom/oomd-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/oom/oomd-util.c b/src/oom/oomd-util.c
index b054ccacc4..82bc9e2529 100644
--- a/src/oom/oomd-util.c
+++ b/src/oom/oomd-util.c
@@ -384,7 +384,7 @@ int oomd_system_context_acquire(const char *proc_swaps_path, OomdSystemContext *
int oomd_insert_cgroup_context(Hashmap *old_h, Hashmap *new_h, const char *path) {
_cleanup_(oomd_cgroup_context_freep) OomdCGroupContext *curr_ctx = NULL;
- OomdCGroupContext *old_ctx, *ctx;
+ OomdCGroupContext *old_ctx;
int r;
assert(new_h);
@@ -401,11 +401,11 @@ int oomd_insert_cgroup_context(Hashmap *old_h, Hashmap *new_h, const char *path)
curr_ctx->last_hit_mem_pressure_limit = old_ctx->last_hit_mem_pressure_limit;
}
- ctx = TAKE_PTR(curr_ctx);
- r = hashmap_put(new_h, ctx->path, ctx);
+ r = hashmap_put(new_h, curr_ctx->path, curr_ctx);
if (r < 0)
return r;
+ TAKE_PTR(curr_ctx);
return 0;
}