提交 81a8fc34 编写于 作者: J John Ferlan

qemu: Resolve Coverity NEGATIVE_RETURNS

Coverity notes that if the virConnectListAllDomains returns a negative
value then the loop at the cleanup label that ends on numDomains will
have issues.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 b74a3fb3
...@@ -1004,9 +1004,11 @@ qemuStateStop(void) ...@@ -1004,9 +1004,11 @@ qemuStateStop(void)
ret = -1; ret = -1;
cleanup: cleanup:
for (i = 0; i < numDomains; i++) if (domains) {
virDomainFree(domains[i]); for (i = 0; i < numDomains; i++)
VIR_FREE(domains); virDomainFree(domains[i]);
VIR_FREE(domains);
}
VIR_FREE(flags); VIR_FREE(flags);
virObjectUnref(conn); virObjectUnref(conn);
virObjectUnref(cfg); virObjectUnref(cfg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册