mirror of https://gitee.com/openkylin/libvirt.git
Fix ref-counting for Xen driver event registration
This commit is contained in:
parent
d6511cf6de
commit
65316d7940
|
@ -1,3 +1,8 @@
|
||||||
|
Thu Jan 15 01:16:05 GMT 2009 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* src/xen_unified.c: Fix ref-counting for Xen driver event
|
||||||
|
registration
|
||||||
|
|
||||||
Wed Jan 14 17:30:54 GMT 2009 John Levon <levon@movementarian.org>
|
Wed Jan 14 17:30:54 GMT 2009 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* docs/devhelp/Makefile.am: Fix devhelp build dependencies
|
* docs/devhelp/Makefile.am: Fix devhelp build dependencies
|
||||||
|
|
|
@ -1359,15 +1359,21 @@ xenUnifiedDomainEventRegister (virConnectPtr conn,
|
||||||
void *opaque,
|
void *opaque,
|
||||||
void (*freefunc)(void *))
|
void (*freefunc)(void *))
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
GET_PRIVATE (conn);
|
GET_PRIVATE (conn);
|
||||||
if (priv->xsWatch == -1) {
|
if (priv->xsWatch == -1) {
|
||||||
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->refs++;
|
ret = virDomainEventCallbackListAdd(conn, priv->domainEventCallbacks,
|
||||||
return virDomainEventCallbackListAdd(conn, priv->domainEventCallbacks,
|
|
||||||
callback, opaque, freefunc);
|
callback, opaque, freefunc);
|
||||||
|
|
||||||
|
if (ret == 0)
|
||||||
|
conn->refs++;
|
||||||
|
|
||||||
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1383,6 +1389,8 @@ xenUnifiedDomainEventDeregister (virConnectPtr conn,
|
||||||
|
|
||||||
ret = virDomainEventCallbackListRemove(conn, priv->domainEventCallbacks,
|
ret = virDomainEventCallbackListRemove(conn, priv->domainEventCallbacks,
|
||||||
callback);
|
callback);
|
||||||
|
|
||||||
|
if (ret == 0)
|
||||||
virUnrefConnect(conn);
|
virUnrefConnect(conn);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue