]> xenbits.xensource.com Git - libvirt.git/commit
Fix crash on events due to allocation errors
authorDaniel Veillard <veillard@redhat.com>
Tue, 20 Sep 2011 03:51:50 +0000 (11:51 +0800)
committerDaniel Veillard <veillard@redhat.com>
Tue, 20 Sep 2011 03:51:50 +0000 (11:51 +0800)
commit675464b183f006fd805644075503f2d9bd647576
tree63046a2e2c1b49cb553266d0b2eb00caa0abf18f
parent19ff0ddfbbeff8dec0c40aeaa0fe9584573dfad7
Fix crash on events due to allocation errors

remoteRelayDomainEventBlockJob, remoteRelayDomainEventIOError,
remoteRelayDomainEventIOErrorReason and remoteRelayDomainEventGraphics
were using const string directly in rpc structure, before calling
remoteDispatchDomainEventSend(). But that routine now frees up all
the pointed allocated memory from the rpc structure and we end up
with a double free.
This now strdup() all the strings passed and provide mem_error goto
labels to be used when an allocation error occurs.
Note that the cleanup isn't completely finished because all relaying
function also call make_nonnull_domain() which also allocate a string
and never handle the error case. This patches doesn't try to address
this as this is only error correctness a priori and touches far more
functions in this module:

* daemon/remote.c: fix string allocations and memory error handling
  for remoteRelayDomainEventBlockJob, remoteRelayDomainEventIOError,
  remoteRelayDomainEventIOErrorReason and remoteRelayDomainEventGraphics
daemon/remote.c