[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] conf: avoid libvirt crash with empty address guestfwd channel

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".


Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]