This commit fixes a segmentation fault caused by missing conditional to
check if libxl configuration was properly created by the test. If the
configuration was not properly created, libxlDriverConfigNew() function
will return NULL and cause a segfault at cfg->caps = NULL during the
cleanup.
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
tests/libxlxml2domconfigtest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c
index 34a63e22b5..a9758c40cb 100644
--- a/tests/libxlxml2domconfigtest.c
+++ b/tests/libxlxml2domconfigtest.c
@@ -138,7 +138,8 @@ testCompareXMLToDomConfig(const char *xmlfile,
libxl_domain_config_dispose(&actualconfig);
libxl_domain_config_dispose(&expectconfig);
xtl_logger_destroy(log);
- cfg->caps = NULL;
+ if (cfg)
+ cfg->caps = NULL;
virObjectUnref(cfg);
return ret;
}
--
2.17.1