mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
rpc: Fix reference counting around virNetSocketAddIOCallback
Ref service passed as a parameter to the callback. And don't unref the socket that is part of the service being passed at another point in code. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
2128d2e920
commit
ccb05762ad
@ -301,12 +301,15 @@ virNetServerServicePtr virNetServerServiceNewFD(int fd,
|
||||
|
||||
/* IO callback is initially disabled, until we're ready
|
||||
* to deal with incoming clients */
|
||||
virObjectRef(svc);
|
||||
if (virNetSocketAddIOCallback(svc->socks[i],
|
||||
0,
|
||||
virNetServerServiceAccept,
|
||||
svc,
|
||||
virObjectFreeCallback) < 0)
|
||||
virObjectFreeCallback) < 0) {
|
||||
virObjectUnref(svc);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -386,7 +389,6 @@ virNetServerServicePtr virNetServerServiceNewPostExecRestart(virJSONValuePtr obj
|
||||
svc,
|
||||
virObjectFreeCallback) < 0) {
|
||||
virObjectUnref(svc);
|
||||
virObjectUnref(sock);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user