提交 2718a3d8 编写于 作者: J Jim Meyering

vbox_tmpl.c: avoid NULL deref upon vboxDomainCreateXML failure

* src/vbox/vbox_tmpl.c (vboxDomainCreateXML): Don't call
vboxDomainUndefine on a NULL "dom".
上级 f2d8c9d0
...@@ -990,8 +990,6 @@ cleanup: ...@@ -990,8 +990,6 @@ cleanup:
static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml, static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
unsigned int flags ATTRIBUTE_UNUSED) { unsigned int flags ATTRIBUTE_UNUSED) {
virDomainPtr dom = NULL;
/* VirtualBox currently doesn't have support for running /* VirtualBox currently doesn't have support for running
* virtual machines without actually defining them and thus * virtual machines without actually defining them and thus
* for time being just define new machine and start it. * for time being just define new machine and start it.
...@@ -1000,19 +998,16 @@ static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml, ...@@ -1000,19 +998,16 @@ static virDomainPtr vboxDomainCreateXML(virConnectPtr conn, const char *xml,
* change this behaviour to the expected one. * change this behaviour to the expected one.
*/ */
dom = vboxDomainDefineXML(conn, xml); virDomainPtr dom = vboxDomainDefineXML(conn, xml);
if (dom) { if (dom == NULL)
if (vboxDomainCreate(dom) < 0) return NULL;
goto cleanup;
} else { if (vboxDomainCreate(dom) < 0) {
goto cleanup; vboxDomainUndefine(dom);
return NULL;
} }
return dom; return dom;
cleanup:
vboxDomainUndefine(dom);
return NULL;
} }
static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) { static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册