提交 c6ec7c6b 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
上级 b54f4881
......@@ -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)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册