diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-05-12 11:36:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-12 11:36:32 +0200 |
commit | 8f7123731d2a269ee9985cc265b6e69af63c1b6b (patch) | |
tree | 5c53f46aa80cce27e40b2df5a12582e2f9d8fabf /src/core | |
parent | 01d0123f044d6c090b6ac2f6d304de2bdb19ae3b (diff) | |
parent | d65e974e67e47222cdebd9d0b6becd6642547ce2 (diff) | |
download | systemd-8f7123731d2a269ee9985cc265b6e69af63c1b6b.tar.gz |
Merge pull request #18986 from poettering/oomd-varlink-fix
varlink ref fix
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core-varlink.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/core-varlink.c b/src/core/core-varlink.c index b3df8cd893..b7afb87d50 100644 --- a/src/core/core-varlink.c +++ b/src/core/core-varlink.c @@ -475,8 +475,11 @@ int manager_varlink_init(Manager *m) { void manager_varlink_done(Manager *m) { assert(m); - /* Send the final message if we still have a subscribe request open. */ - m->managed_oom_varlink_request = varlink_close_unref(m->managed_oom_varlink_request); + /* Explicitly close the varlink connection to oomd. Note we first take the varlink connection out of + * the manager, and only then disconnect it — in two steps – so that we don't end up accidentally + * unreffing it twice. After all, closing the connection might cause the disconnect handler we + * installed (vl_disconnect() above) to be called, where we will unref it too. */ + varlink_close_unref(TAKE_PTR(m->managed_oom_varlink_request)); m->varlink_server = varlink_server_unref(m->varlink_server); } |