提交 fc1c16bc 编写于 作者: J Ján Tomko

qemuBuildControllersByTypeCommandLine: free devstr in the cleanup

section
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 c7e03df8
......@@ -3145,12 +3145,12 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
virQEMUCapsPtr qemuCaps,
virDomainControllerType type)
{
char *devstr = NULL;
int ret = -1;
size_t i;
for (i = 0; i < def->ncontrollers; i++) {
virDomainControllerDefPtr cont = def->controllers[i];
char *devstr;
if (cont->type != type)
continue;
......@@ -3183,23 +3183,22 @@ qemuBuildControllersByTypeCommandLine(virCommandPtr cmd,
continue;
}
VIR_FREE(devstr);
if (qemuBuildControllerDevStr(def, cont, qemuCaps, &devstr) < 0)
goto cleanup;
if (devstr) {
if (qemuCommandAddExtDevice(cmd, &cont->info) < 0) {
VIR_FREE(devstr);
if (qemuCommandAddExtDevice(cmd, &cont->info) < 0)
goto cleanup;
}
virCommandAddArg(cmd, "-device");
virCommandAddArg(cmd, devstr);
VIR_FREE(devstr);
}
}
ret = 0;
cleanup:
VIR_FREE(devstr);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册