virt-admin: Fix segfault when libvirtd dies

vshAdmCatchDisconnect requires non-NULL structure vshControl for
getting connection name (stored at opaque), but
virAdmConnectRegisterCloseCallback at vshAdmConnect called it
with NULL.

Signed-off-by: Adam Julis <ajulis@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Adam Julis 2024-03-19 12:02:51 +01:00 committed by Ján Tomko
parent a7e258d7c9
commit 478774eada

View File

@ -112,7 +112,7 @@ vshAdmConnect(vshControl *ctl, unsigned int flags)
return -1; return -1;
} else { } else {
if (virAdmConnectRegisterCloseCallback(priv->conn, vshAdmCatchDisconnect, if (virAdmConnectRegisterCloseCallback(priv->conn, vshAdmCatchDisconnect,
NULL, NULL) < 0) ctl, NULL) < 0)
vshError(ctl, "%s", _("Unable to register disconnect callback")); vshError(ctl, "%s", _("Unable to register disconnect callback"));
if (priv->wantReconnect) if (priv->wantReconnect)