From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> 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@xxxxxxxxxx> --- src/rpc/virnetserverservice.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c index d84b6defd4e5..9087473efd39 100644 --- a/src/rpc/virnetserverservice.c +++ b/src/rpc/virnetserverservice.c @@ -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; } } -- 2.4.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list