mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9ee5a79830
commit
355d8f470f
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user