提交 ccb05762 编写于 作者: D Daniel P. Berrange 提交者: Martin Kletzander

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: NMartin Kletzander <mkletzan@redhat.com>
上级 2128d2e9
......@@ -301,13 +301,16 @@ 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;
}
}
return svc;
......@@ -386,7 +389,6 @@ virNetServerServicePtr virNetServerServiceNewPostExecRestart(virJSONValuePtr obj
svc,
virObjectFreeCallback) < 0) {
virObjectUnref(svc);
virObjectUnref(sock);
goto error;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册