[libvirt] [PATCH] conf: avoid libvirt crash with empty address guestfwd channel
Eric Blake
eblake at redhat.com
Thu Sep 13 16:38:39 UTC 2012
On 09/13/2012 10:23 AM, Alex Jia wrote:
> The 'def->target.addr' hasn't been initialized in virDomainChrDefNew() and
> its value is always '0xffffffff', in addition, the following test scenario
> hasn't also include 'port' element in channel XML block, so the branch
> 'if (addrStr == NULL)' is hit in virDomainChrDefParseTargetXML(), the
> programming jumps to 'error' label to release relevant resources, and the
> statement 'if (VIR_ALLOC(def->target.addr) < 0)' hasn't been executed then
> the virDomainChrDefFree() will free 'def->target.addr'(0xffffffff) via
> VIR_FREE(), which results in libvirt crash, to use valgrind can also
> find a 'Invalid free() / delete / delete[]' error. This patch just adjusts
> codes order to initialize 'def->target.addr' firstly.
>
> With this patch, libvirt hasn't crash and can get a expected error message "
> XML error: guestfwd channel does not define a target address".
ACK.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120913/6fb34157/attachment-0001.sig>
More information about the libvir-list
mailing list