提交 7584d992 编写于 作者: M Michal Privoznik

virshConnect: Don't leak polkit agent

In our attempts to reconnect, we may create a polkit daemon.
However, it may happen that we would rewrite the variable that
already holds pointer to the agent.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 1758ee4a
......@@ -168,7 +168,7 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly)
err = virGetLastError();
if (err && err->domain == VIR_FROM_POLKIT &&
err->code == VIR_ERR_AUTH_UNAVAILABLE) {
if (!(pkagent = virPolkitAgentCreate()))
if (!pkagent && !(pkagent = virPolkitAgentCreate()))
goto cleanup;
} else if (err && err->domain == VIR_FROM_POLKIT &&
err->code == VIR_ERR_AUTH_FAILED) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册