qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-1.5 0/2] QMP queue
@ 2013-05-15 13:39 Luiz Capitulino
  2013-05-15 13:39 ` [Qemu-devel] [PULL 1/2] qmp: fix handling of cmd with Equals in qmp-shell Luiz Capitulino
  2013-05-15 13:39 ` [Qemu-devel] [PULL 2/2] qapi: fix leak in unit tests Luiz Capitulino
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Capitulino @ 2013-05-15 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

These two fixes are not hugely important, but they are pretty isolated
anyway.

The changes (since 110db9b48c0a6379fca122801c3ae48e349aa6d4) are available
in the following repository:

    git://repo.or.cz/qemu/qmp-unstable.git queue/qmp

Michael Roth (1):
  qapi: fix leak in unit tests

Zhangleiqiang (1):
  qmp: fix handling of cmd with Equals in qmp-shell

 QMP/qmp-shell                      | 2 ++
 tests/test-visitor-serialization.c | 9 +++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL 1/2] qmp: fix handling of cmd with Equals in qmp-shell
  2013-05-15 13:39 [Qemu-devel] [PULL for-1.5 0/2] QMP queue Luiz Capitulino
@ 2013-05-15 13:39 ` Luiz Capitulino
  2013-05-15 13:39 ` [Qemu-devel] [PULL 2/2] qapi: fix leak in unit tests Luiz Capitulino
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Capitulino @ 2013-05-15 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

From: Zhangleiqiang <zhangleiqiang@huawei.com>

	qmp: fix handling of cmd with equal mark in qmp-shell

    qmp-shell splits the argument and value of input command
	by equal mark("="). But there are commands whose values
	include equal mark themselves, and the json built by
	qmp-shell will not correct. For example, when using NBD as
	the target of block-backup command, the input
	"block-backup target=nbd+unix:///drive0?socket=/tmp/nbd.sock"
	will fail, because the json built will be as follows:

    {
		"execute":"block-backup",
		"arguments":{"target":"nbd+unix:///drive0?socket"}
	}

    Fix it by joining the sections split by equal mark excluding the
	first section in __build_cmd function when the length of sections
	is larger than two.

Signed-off-by: zhangleiqiang <zhangleiqiang@huawei.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 QMP/qmp-shell | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/QMP/qmp-shell b/QMP/qmp-shell
index d126e63..73cb3b6 100755
--- a/QMP/qmp-shell
+++ b/QMP/qmp-shell
@@ -99,6 +99,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
         for arg in cmdargs[1:]:
             opt = arg.split('=')
             try:
+                if(len(opt) > 2):
+                    opt[1] = '='.join(opt[1:])
                 value = int(opt[1])
             except ValueError:
                 if opt[1] == 'true':
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL 2/2] qapi: fix leak in unit tests
  2013-05-15 13:39 [Qemu-devel] [PULL for-1.5 0/2] QMP queue Luiz Capitulino
  2013-05-15 13:39 ` [Qemu-devel] [PULL 1/2] qmp: fix handling of cmd with Equals in qmp-shell Luiz Capitulino
@ 2013-05-15 13:39 ` Luiz Capitulino
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Capitulino @ 2013-05-15 13:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

From: Michael Roth <mdroth@linux.vnet.ibm.com>

qmp_output_get_qobject() increments the qobject's reference count. Since
we currently pass this straight into qobject_to_json() so we can feed
the data into a QMP input visitor, we never actually free the underlying
qobject when qmp_output_visitor_cleanup() is called. This causes leaks
on all of the QMP serialization tests.

Fix this by holding a pointer to the qobject and decref'ing it before
returning from qmp_deserialize().

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 tests/test-visitor-serialization.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c
index e84926f..8c8adac 100644
--- a/tests/test-visitor-serialization.c
+++ b/tests/test-visitor-serialization.c
@@ -657,11 +657,16 @@ static void qmp_deserialize(void **native_out, void *datap,
                             VisitorFunc visit, Error **errp)
 {
     QmpSerializeData *d = datap;
-    QString *output_json = qobject_to_json(qmp_output_get_qobject(d->qov));
-    QObject *obj = qobject_from_json(qstring_get_str(output_json));
+    QString *output_json;
+    QObject *obj_orig, *obj;
+
+    obj_orig = qmp_output_get_qobject(d->qov);
+    output_json = qobject_to_json(obj_orig);
+    obj = qobject_from_json(qstring_get_str(output_json));
 
     QDECREF(output_json);
     d->qiv = qmp_input_visitor_new(obj);
+    qobject_decref(obj_orig);
     qobject_decref(obj);
     visit(qmp_input_get_visitor(d->qiv), native_out, errp);
 }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-15 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 13:39 [Qemu-devel] [PULL for-1.5 0/2] QMP queue Luiz Capitulino
2013-05-15 13:39 ` [Qemu-devel] [PULL 1/2] qmp: fix handling of cmd with Equals in qmp-shell Luiz Capitulino
2013-05-15 13:39 ` [Qemu-devel] [PULL 2/2] qapi: fix leak in unit tests Luiz Capitulino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).