提交 15613359 编写于 作者: J Jim Meyering

tests: teach syntax-check that virDomainDefFree has free-like semantics

* cfg.mk (useless_free_options): Add virDomainDefFree to the list
of free-like functions.
* src/test/test_driver.c (testDomainCreateXML): Remove useless-if-
before-virDomainDefFree.
* src/conf/domain_conf.c (virDomainAssignDef): Likewise
上级 e36be6e7
...@@ -64,6 +64,7 @@ useless_free_options = \ ...@@ -64,6 +64,7 @@ useless_free_options = \
--name=VIR_FREE \ --name=VIR_FREE \
--name=xmlFree \ --name=xmlFree \
--name=xmlXPathFreeContext \ --name=xmlXPathFreeContext \
--name=virDomainDefFree \
--name=xmlXPathFreeObject --name=xmlXPathFreeObject
# Avoid uses of write(2). Either switch to streams (fwrite), or use # Avoid uses of write(2). Either switch to streams (fwrite), or use
......
...@@ -759,7 +759,6 @@ virDomainObjPtr virDomainAssignDef(virCapsPtr caps, ...@@ -759,7 +759,6 @@ virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
virDomainDefFree(domain->def); virDomainDefFree(domain->def);
domain->def = def; domain->def = def;
} else { } else {
if (domain->newDef)
virDomainDefFree(domain->newDef); virDomainDefFree(domain->newDef);
domain->newDef = def; domain->newDef = def;
} }
......
...@@ -1328,7 +1328,6 @@ cleanup: ...@@ -1328,7 +1328,6 @@ cleanup:
virDomainObjUnlock(dom); virDomainObjUnlock(dom);
if (event) if (event)
testDomainEventQueue(privconn, event); testDomainEventQueue(privconn, event);
if (def)
virDomainDefFree(def); virDomainDefFree(def);
testDriverUnlock(privconn); testDriverUnlock(privconn);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册