[libvirt] [PATCH 1/3] Add missing check for OOM when building boot menu args

Daniel P. Berrange berrange at redhat.com
Tue Sep 24 10:10:56 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

When building boot menu args, if OOM occurred the CLI args
would end up containing  'order=(null)' due to a missing
call to 'virBufferError'.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/qemu/qemu_command.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 850ccea..9900b41 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8057,6 +8057,11 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (boot_nparams > 0) {
             virCommandAddArg(cmd, "-boot");
 
+            if (virBufferError(&boot_buf)) {
+                virReportOOMError();
+                goto error;
+            }
+
             if (boot_nparams < 2 || emitBootindex) {
                 virCommandAddArgBuffer(cmd, &boot_buf);
                 virBufferFreeAndReset(&boot_buf);
-- 
1.8.3.1




More information about the libvir-list mailing list