提交 ce35122c 编写于 作者: N Nikolay Shirokovskiy 提交者: Erik Skultety

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: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: NErik Skultety <eskultet@redhat.com>
上级 0b36b0e9
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册