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>
/* 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;
+ }
}
svc,
virObjectFreeCallback) < 0) {
virObjectUnref(svc);
- virObjectUnref(sock);
goto error;
}
}