mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Fix memory leak dispatching domain events
When dispatching domain events we will create an XDR struct containing the event info. Some of this data may be allocated on the heap and so must be freed. The graphics event dispatcher had a broken attempt to free one field, but missed others. All the events have a dom->name string that needs freeing. The code should have used the xdr_free() procedure for doing all this * daemon/remote.c: Use xdr_free after dispatching events
This commit is contained in:
parent
c32536e7da
commit
a91d3115b5
@ -334,8 +334,6 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
REMOTE_PROC_DOMAIN_EVENT_GRAPHICS,
|
||||
(xdrproc_t)xdr_remote_domain_event_graphics_msg, &data);
|
||||
|
||||
VIR_FREE(data.subject.subject_val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2498,7 +2496,7 @@ remoteDispatchDomainEventSend(virNetServerClientPtr client,
|
||||
virNetMessagePtr msg;
|
||||
|
||||
if (!(msg = virNetMessageNew()))
|
||||
return;
|
||||
goto cleanup;
|
||||
|
||||
msg->header.prog = virNetServerProgramGetID(program);
|
||||
msg->header.vers = virNetServerProgramGetVersion(program);
|
||||
@ -2516,10 +2514,12 @@ remoteDispatchDomainEventSend(virNetServerClientPtr client,
|
||||
VIR_DEBUG("Queue event %d %zu", procnr, msg->bufferLength);
|
||||
virNetServerClientSendMessage(client, msg);
|
||||
|
||||
xdr_free(proc, data);
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
virNetMessageFree(msg);
|
||||
xdr_free(proc, data);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user