[libvirt] [PATCH] qemu: check for json allocation failure
Detected by Coverity. Introduced in commit b1b5b51. * src/qemu/qemu_monitor_json.c (qemuMonitorJSONGetBlockInfo): Avoid null dereference on OOM. --- src/qemu/qemu_monitor_json.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 18d1c9f..cd8f1e5 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); -- 1.7.4.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: check for json allocation failure
On 10/13/2011 02:13 AM, Eric Blake wrote: diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 18d1c9f..cd8f1e5 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); ACK, Peter. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: check for json allocation failure
On 10/13/2011 02:41 AM, Peter Krempa wrote: On 10/13/2011 02:13 AM, Eric Blake wrote: diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 18d1c9f..cd8f1e5 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); ACK, Pushed. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list