diff options
author | Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> | 2016-03-03 11:01:15 +0300 |
---|---|---|
committer | Erik Skultety <eskultet@redhat.com> | 2016-03-03 11:02:11 +0100 |
commit | ce35122cfeb43c92d4cbea83530cd13144cd591c (patch) | |
tree | 75004467f95d44bd2e5f05a7852ce5a214298d6b /daemon | |
parent | 0b36b0e9ce83e8f96de27dffa90a0cb28cb229c9 (diff) | |
download | libvirt-ce35122cfeb43c92d4cbea83530cd13144cd591c.tar.gz |
daemon: fixup refcounting in close callback handling
remoteDispatchConnectCloseCallbackRegister introduced in
f484310a has problems. It refcounts network client object and in case of NOOP
driver operations for registering/unregistering close callback (any driver
except for vz) nobody will unref it later. As a result, client connection
will not be disposed and driver connection will not be closed.
The fix is easy. We don't need to refcount at all. We don't get a dangling
pointer because in remoteClientFreeFunc, which is called
upon disposing this network client object, we unregister the close
callback.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/remote.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index 04d8ada729..17783fa652 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -3382,11 +3382,9 @@ remoteDispatchConnectCloseCallbackRegister(virNetServerPtr server ATTRIBUTE_UNUS goto cleanup; } - // on behalf of close callback - virObjectRef(client); if (virConnectRegisterCloseCallback(priv->conn, remoteRelayConnectionClosedEvent, - client, virObjectFreeCallback) < 0) + client, NULL) < 0) goto cleanup; priv->closeRegistered = true; |