mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
5e55534b9a
commit
fcc2aab688
@ -974,8 +974,10 @@ int virNetServerAddService(virNetServerPtr srv,
|
||||
|
||||
if (!virNetServerMDNSAddEntry(srv->mdnsGroup,
|
||||
mdnsEntryName,
|
||||
port))
|
||||
port)) {
|
||||
srv->nservices--;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
srv->services[srv->nservices-1] = svc;
|
||||
|
Loading…
Reference in New Issue
Block a user