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.
This commit is contained in:
Ján Tomko 2013-09-20 13:02:43 +02:00
parent 83c24493df
commit 5b36ab900a

View File

@ -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\":{}}";