]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vbox: fix SEGV during dumpxml of a serial port
authorLaine Stump <laine@laine.org>
Sun, 21 Jan 2018 02:11:05 +0000 (21:11 -0500)
committerLaine Stump <laine@laine.org>
Fri, 2 Feb 2018 20:16:19 +0000 (15:16 -0500)
commit9c27e464e3b4603cbe13c00787f4c89e5b1e7a68
tree7c7b54e74716b86c07287dab52c6494f73696efa
parent5866f486731308fe3996092afc6e72e9cf9c9fb6
vbox: fix SEGV during dumpxml of a serial port

commit 77a12987a48 changed the "virDomainChrSourceDef source" inside
virDomainChrDef to "virDomainChrSourceDefPtr source", and started
allocating source inside virDomainChrDefNew(), but vboxDumpSerial()
was allocating a virDomainChrDef with a simple VIR_ALLOC() (i.e. never
calling virDomainChrDefNew()), so source was never initialized,
leading to a SEGV any time a serial port was present. The same problem
was created in vboxDumpParallel().

This patch changes vboxDumpSerial() and vboxDumpParallel() to use
virDomainChrDefNew() instead of VIR_ALLOC(), and changes both of those
functions to return an error if virDomainChrDef() (or any other
allocation) fails.

This resolves: https://bugzilla.redhat.com/1536649
src/vbox/vbox_common.c