On 03/26/2018 01:39 AM, Peter Xu wrote:
It is abstracted from qtest_init_without_qmp_handshake(). It works just
like qtest_init_without_qmp_handshake() but further it would allow the
caller to specify the QMP parameter.

Signed-off-by: Peter Xu <pet...@redhat.com>
---
  tests/libqtest.c | 14 +++++++++++---
  tests/libqtest.h | 14 ++++++++++++++
  2 files changed, 25 insertions(+), 3 deletions(-)


+    gchar *qmp_params;
      const char *qemu_binary = qtest_qemu_binary();
s = g_new(QTestState, 1); socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid());
      qmp_socket_path = g_strdup_printf("/tmp/qtest-%d.qmp", getpid());
+    qmp_params = g_strdup_printf(qmp_format, qmp_socket_path);

Memory leak of qmp_params. Avoided in my rewrite to use bool instead of a format string.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to