mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
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:
parent
83c24493df
commit
5b36ab900a
@ -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\":{}}";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user