mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
tests: Alter logic in testCompareXMLToDomConfig
Rather than initialize actualconfig and expectconfig before having the possibility that libxlDriverConfigNew could fail and thus land in cleanup, let's just move them and return immediately upon failure. Signed-off-by: John Ferlan <jferlan@redhat.com> ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
efdbfe57c7
commit
8f3c00c6e8
@ -62,14 +62,14 @@ testCompareXMLToDomConfig(const char *xmlfile,
|
||||
char *tempjson = NULL;
|
||||
char *expectjson = NULL;
|
||||
|
||||
libxl_domain_config_init(&actualconfig);
|
||||
libxl_domain_config_init(&expectconfig);
|
||||
|
||||
if (!(cfg = libxlDriverConfigNew()))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
cfg->caps = caps;
|
||||
|
||||
libxl_domain_config_init(&actualconfig);
|
||||
libxl_domain_config_init(&expectconfig);
|
||||
|
||||
if (!(log = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr, XTL_DEBUG, 0)))
|
||||
goto cleanup;
|
||||
|
||||
@ -135,7 +135,6 @@ testCompareXMLToDomConfig(const char *xmlfile,
|
||||
libxl_domain_config_dispose(&actualconfig);
|
||||
libxl_domain_config_dispose(&expectconfig);
|
||||
xtl_logger_destroy(log);
|
||||
if (cfg)
|
||||
cfg->caps = NULL;
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user