mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-27 14:54:14 +00:00
Make sure conn exists before use it
Although all the used functions have a explicit check for a valid virConnPtr, let's be safe and only use priv->conn when its value is non-NULL.
This commit is contained in:
parent
1c69f3cf40
commit
de8b381fa4
@ -529,15 +529,17 @@ virt_viewer_dispose (GObject *object)
|
||||
VirtViewer *self = VIRT_VIEWER(object);
|
||||
VirtViewerPrivate *priv = self->priv;
|
||||
|
||||
if (priv->withEvents)
|
||||
virConnectDomainEventDeregister(priv->conn,
|
||||
virt_viewer_domain_event);
|
||||
virConnectUnregisterCloseCallback(priv->conn,
|
||||
virt_viewer_conn_event);
|
||||
if (priv->conn) {
|
||||
if (priv->withEvents)
|
||||
virConnectDomainEventDeregister(priv->conn,
|
||||
virt_viewer_domain_event);
|
||||
virConnectUnregisterCloseCallback(priv->conn,
|
||||
virt_viewer_conn_event);
|
||||
virConnectClose(priv->conn);
|
||||
priv->conn = NULL;
|
||||
}
|
||||
if (priv->dom)
|
||||
virDomainFree(priv->dom);
|
||||
if (priv->conn)
|
||||
virConnectClose(priv->conn);
|
||||
g_free(priv->uri);
|
||||
priv->uri = NULL;
|
||||
g_free(priv->domkey);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user