提交 355d8f47 编写于 作者: M Michal Privoznik

virNetServerServiceClose: Don't leak sockets

Well, if a server is being destructed, all underlying services and
their sockets should disappear with it. But due to bug in our
implementation this is not the case. Yes, we are closing the sockets,
but that's not enough. We must also:

1) Unregister them from the event loop
2) Unref the service for each socket

The last step is needed, because each socket callback holds a
reference to the service object. Since in the first step we are
unregistering the callbacks, they no longer need the reference.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 9ee5a798
......@@ -520,6 +520,9 @@ void virNetServerServiceClose(virNetServerServicePtr svc)
if (!svc)
return;
for (i = 0; i < svc->nsocks; i++)
for (i = 0; i < svc->nsocks; i++) {
virNetSocketRemoveIOCallback(svc->socks[i]);
virNetSocketClose(svc->socks[i]);
virObjectUnref(svc);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册