mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
tests: Check for virQEMUDriverConfigNew return value
The function may return NULL if something went wrong. In some places in the tests we are not checking the return value rather than accessing the pointer directly resulting in SIGSEGV. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
b54f48812d
commit
c6ec7c6b0b
@ -231,6 +231,9 @@ mymain(void)
|
||||
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverConfigNew(false);
|
||||
|
||||
if (!cfg)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
# define DO_TEST_QEMU(Filename, QemuCapsFile, Emulatorbin, Machine, Arch, Type, ...) \
|
||||
do { \
|
||||
const char *capsPath = abs_srcdir "/qemucapabilitiesdata/" QemuCapsFile ".caps"; \
|
||||
|
@ -348,7 +348,8 @@ mymain(void)
|
||||
|
||||
virEventRegisterDefaultImpl();
|
||||
|
||||
driver.config = virQEMUDriverConfigNew(false);
|
||||
if (!(driver.config = virQEMUDriverConfigNew(false)))
|
||||
return EXIT_FAILURE;
|
||||
VIR_FREE(driver.config->spiceListen);
|
||||
VIR_FREE(driver.config->vncListen);
|
||||
/* some dummy values from 'config file' */
|
||||
|
@ -211,7 +211,8 @@ mymain(void)
|
||||
if (!abs_top_srcdir)
|
||||
abs_top_srcdir = abs_srcdir "/..";
|
||||
|
||||
driver.config = virQEMUDriverConfigNew(false);
|
||||
if (!(driver.config = virQEMUDriverConfigNew(false)))
|
||||
return EXIT_FAILURE;
|
||||
if ((driver.caps = testQemuCapsInit()) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
|
||||
|
Loading…
Reference in New Issue
Block a user