提交 2224989c 编写于 作者: D Daniel P. Berrange

Avoid free'ing a constant string in chardev lookup code

 * src/qemu/qemu_monitor_text.c: Don't free const string in
   qemuMonitorTextGetPtyPaths()
上级 4359900e
......@@ -1678,14 +1678,12 @@ cleanup:
int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
virHashTablePtr paths)
{
const char *cmd = "info chardev";
char *reply = NULL;
int ret = -1;
if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
_("failed to retrieve chardev info in qemu with '%s'"),
cmd);
if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
_("failed to retrieve chardev info in qemu with 'info chardev'"));
goto cleanup;
}
......@@ -1747,7 +1745,6 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
ret = 0;
cleanup:
VIR_FREE(cmd);
VIR_FREE(reply);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册