[libvirt] [PATCH] qemu: fix memory leak on -machine usage error

Eric Blake eblake at redhat.com
Wed Apr 3 17:31:10 UTC 2013


Commit f84b92ea introduced a memory leak on error; John Ferlan reported
that valgrind caught it during 'make check'.

* src/qemu/qemu_command.c (qemuBuildMachineArgStr): Plug leak.
---

Pushing under the trivial rule.

 src/qemu/qemu_command.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 693d30d..29424d6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5228,6 +5228,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("dump-guest-core is not available "
                                  "with this QEMU binary"));
+                virBufferFreeAndReset(&buf);
                 return -1;
             }

-- 
1.8.1.4




More information about the libvir-list mailing list