提交 fcc2aab6 编写于 作者: M Martin Kletzander

rpc: Fix possible crash when MDNSAddEntry fails

If virNetServerMDNSAddEntry() fails when adding a service to a server,
it doesn't decrease the number of services.  Hence access to their
members segfaults (e.g. when free()-ing the sruct).
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 5e55534b
...@@ -974,8 +974,10 @@ int virNetServerAddService(virNetServerPtr srv, ...@@ -974,8 +974,10 @@ int virNetServerAddService(virNetServerPtr srv,
if (!virNetServerMDNSAddEntry(srv->mdnsGroup, if (!virNetServerMDNSAddEntry(srv->mdnsGroup,
mdnsEntryName, mdnsEntryName,
port)) port)) {
srv->nservices--;
goto error; goto error;
}
} }
srv->services[srv->nservices-1] = svc; srv->services[srv->nservices-1] = svc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册