From: Eric Blake Date: Thu, 13 Oct 2011 00:10:24 +0000 (-0600) Subject: qemu: check for json allocation failure X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ce521f242aad8c9bddbe04802c309150f4508b58;p=libvirt.git qemu: check for json allocation failure Detected by Coverity. Introduced in commit b1b5b51. * src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetBlockInfo): Avoid null dereference. --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 18d1c9f51d..cd8f1e599c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1364,6 +1364,9 @@ int qemuMonitorJSONGetBlockInfo(qemuMonitorPtr mon, virJSONValuePtr reply = NULL; virJSONValuePtr devices; + if (!cmd) + return -1; + ret = qemuMonitorJSONCommand(mon, cmd, &reply); if (ret == 0) ret = qemuMonitorJSONCheckError(cmd, reply);