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

Don't dereference NULL in qemumonitorjsontest

In case of an error, qemuMonitorTestNewSimple returns NULL.
Error out instead of dereferencing it.

Found by Coverity, reported by John Ferlan.
上级 83c24493
......@@ -960,6 +960,9 @@ testQemuMonitorJSONCPU(const void *data)
bool running = false;
virDomainPausedReason reason = 0;
if (!test)
return -1;
if (qemuMonitorTestAddItem(test, "stop", "{\"return\": {}}") < 0 ||
qemuMonitorTestAddItem(test, "query-status",
"{\"return\": {"
......@@ -1016,6 +1019,9 @@ testQemuMonitorJSONSimpleFunc(const void *opaque)
const char *reply = data->reply;
int ret = -1;
if (!test)
return -1;
if (!reply)
reply = "{\"return\":{}}";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册