提交 ab6f1c98 编写于 作者: E Eric Blake

qemu: avoid double free of qemu help output

If yajl was not compiled in, we end up freeing an incoming
parameter, which leads to a bogus free later on.  Regression
introduced in commit 6e769eba.

* src/qemu/qemu_capabilities.c (qemuCapsParseHelpStr): Avoid alloc
on failure path, which in turn fixes bogus free.
Reported by Cole Robinson.
上级 93f93f51
......@@ -1330,16 +1330,14 @@ int qemuCapsParseHelpStr(const char *qemu,
fail:
p = strchr(help, '\n');
if (p)
p = strndup(help, p - help);
if (!p)
p = strchr(help, '\0');
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse %s version number in '%s'"),
qemu, p ? p : help);
_("cannot parse %s version number in '%.*s'"),
qemu, (int) (p - help), help);
cleanup:
VIR_FREE(p);
return -1;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册