mirror of https://gitee.com/openkylin/libvirt.git
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: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1758ee4a94
commit
7584d992b8
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue