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,13 +301,16 @@ virNetServerServicePtr virNetServerServiceNewFD(int fd,
|
|||||||
|
|
||||||
/* IO callback is initially disabled, until we're ready
|
/* IO callback is initially disabled, until we're ready
|
||||||
* to deal with incoming clients */
|
* to deal with incoming clients */
|
||||||
|
virObjectRef(svc);
|
||||||
if (virNetSocketAddIOCallback(svc->socks[i],
|
if (virNetSocketAddIOCallback(svc->socks[i],
|
||||||
0,
|
0,
|
||||||
virNetServerServiceAccept,
|
virNetServerServiceAccept,
|
||||||
svc,
|
svc,
|
||||||
virObjectFreeCallback) < 0)
|
virObjectFreeCallback) < 0) {
|
||||||
|
virObjectUnref(svc);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return svc;
|
return svc;
|
||||||
@ -386,7 +389,6 @@ virNetServerServicePtr virNetServerServiceNewPostExecRestart(virJSONValuePtr obj
|
|||||||
svc,
|
svc,
|
||||||
virObjectFreeCallback) < 0) {
|
virObjectFreeCallback) < 0) {
|
||||||
virObjectUnref(svc);
|
virObjectUnref(svc);
|
||||||
virObjectUnref(sock);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user