* [Qemu-devel] [PATCH] tests: fix qmp response leak
@ 2016-11-10 8:36 Marc-André Lureau
2016-11-10 11:02 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Marc-André Lureau @ 2016-11-10 8:36 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, eblake, kwolf, Marc-André Lureau
Spotted by ASAN.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
tests/libqos/usb.c | 1 +
tests/postcopy-test.c | 2 +-
tests/pvpanic-test.c | 1 +
tests/test-filter-mirror.c | 2 +-
tests/test-filter-redirector.c | 4 ++--
tests/virtio-blk-test.c | 15 +++++++++------
6 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c
index 72d7a96..98408d9 100644
--- a/tests/libqos/usb.c
+++ b/tests/libqos/usb.c
@@ -64,4 +64,5 @@ void usb_test_hotplug(const char *hcd_id, const int port,
g_assert(response);
g_assert(qdict_haskey(response, "event"));
g_assert(!strcmp(qdict_get_str(response, "event"), "DEVICE_DELETED"));
+ QDECREF(response);
}
diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c
index d6613c5..985d797 100644
--- a/tests/postcopy-test.c
+++ b/tests/postcopy-test.c
@@ -478,7 +478,7 @@ static void test_migrate(void)
usleep(10 * 1000);
} while (dest_byte_a == dest_byte_b);
- qmp("{ 'execute' : 'stop'}");
+ qmp_discard_response("{ 'execute' : 'stop'}");
/* With it stopped, check nothing changes */
qtest_memread(to, start_address, &dest_byte_c, 1);
sleep(1);
diff --git a/tests/pvpanic-test.c b/tests/pvpanic-test.c
index 3bfa678..71ebb5c 100644
--- a/tests/pvpanic-test.c
+++ b/tests/pvpanic-test.c
@@ -27,6 +27,7 @@ static void test_panic(void)
data = qdict_get_qdict(response, "data");
g_assert(qdict_haskey(data, "action"));
g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause");
+ QDECREF(response);
}
int main(int argc, char **argv)
diff --git a/tests/test-filter-mirror.c b/tests/test-filter-mirror.c
index ffaaffa..9f84402 100644
--- a/tests/test-filter-mirror.c
+++ b/tests/test-filter-mirror.c
@@ -57,7 +57,7 @@ static void test_mirror(void)
};
/* send a qmp command to guarantee that 'connected' is setting to true. */
- qmp("{ 'execute' : 'query-status'}");
+ qmp_discard_response("{ 'execute' : 'query-status'}");
ret = iov_send(send_sock[0], iov, 2, 0, sizeof(size) + sizeof(send_buf));
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
close(send_sock[0]);
diff --git a/tests/test-filter-redirector.c b/tests/test-filter-redirector.c
index c63b68f..0c4b8d5 100644
--- a/tests/test-filter-redirector.c
+++ b/tests/test-filter-redirector.c
@@ -99,7 +99,7 @@ static void test_redirector_tx(void)
g_assert_cmpint(recv_sock, !=, -1);
/* send a qmp command to guarantee that 'connected' is setting to true. */
- qmp("{ 'execute' : 'query-status'}");
+ qmp_discard_response("{ 'execute' : 'query-status'}");
struct iovec iov[] = {
{
@@ -184,7 +184,7 @@ static void test_redirector_rx(void)
send_sock = unix_connect(sock_path1, NULL);
g_assert_cmpint(send_sock, !=, -1);
/* send a qmp command to guarantee that 'connected' is setting to true. */
- qmp("{ 'execute' : 'query-status'}");
+ qmp_discard_response("{ 'execute' : 'query-status'}");
ret = iov_send(send_sock, iov, 2, 0, sizeof(size) + sizeof(send_buf));
g_assert_cmpint(ret, ==, sizeof(send_buf) + sizeof(size));
diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c
index 0e32e41..10a92b4 100644
--- a/tests/virtio-blk-test.c
+++ b/tests/virtio-blk-test.c
@@ -409,8 +409,9 @@ static void pci_config(void)
qvirtio_set_driver_ok(&dev->vdev);
- qmp("{ 'execute': 'block_resize', 'arguments': { 'device': 'drive0', "
- " 'size': %d } }", n_size);
+ qmp_discard_response("{ 'execute': 'block_resize', "
+ " 'arguments': { 'device': 'drive0', "
+ " 'size': %d } }", n_size);
qvirtio_wait_config_isr(&dev->vdev, QVIRTIO_BLK_TIMEOUT_US);
capacity = qvirtio_config_readq(&dev->vdev, 0);
@@ -458,8 +459,9 @@ static void pci_msix(void)
qvirtio_set_driver_ok(&dev->vdev);
- qmp("{ 'execute': 'block_resize', 'arguments': { 'device': 'drive0', "
- " 'size': %d } }", n_size);
+ qmp_discard_response("{ 'execute': 'block_resize', "
+ " 'arguments': { 'device': 'drive0', "
+ " 'size': %d } }", n_size);
qvirtio_wait_config_isr(&dev->vdev, QVIRTIO_BLK_TIMEOUT_US);
@@ -691,8 +693,9 @@ static void mmio_basic(void)
test_basic(&dev->vdev, alloc, vq);
- qmp("{ 'execute': 'block_resize', 'arguments': { 'device': 'drive0', "
- " 'size': %d } }", n_size);
+ qmp_discard_response("{ 'execute': 'block_resize', "
+ " 'arguments': { 'device': 'drive0', "
+ " 'size': %d } }", n_size);
qvirtio_wait_queue_isr(&dev->vdev, vq, QVIRTIO_BLK_TIMEOUT_US);
--
2.10.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tests: fix qmp response leak
2016-11-10 8:36 [Qemu-devel] [PATCH] tests: fix qmp response leak Marc-André Lureau
@ 2016-11-10 11:02 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2016-11-10 11:02 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: qemu-devel, kwolf, pbonzini
[-- Attachment #1: Type: text/plain, Size: 545 bytes --]
On Thu, Nov 10, 2016 at 12:36:29PM +0400, Marc-André Lureau wrote:
> Spotted by ASAN.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> tests/libqos/usb.c | 1 +
> tests/postcopy-test.c | 2 +-
> tests/pvpanic-test.c | 1 +
> tests/test-filter-mirror.c | 2 +-
> tests/test-filter-redirector.c | 4 ++--
> tests/virtio-blk-test.c | 15 +++++++++------
> 6 files changed, 15 insertions(+), 10 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-10 11:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-10 8:36 [Qemu-devel] [PATCH] tests: fix qmp response leak Marc-André Lureau
2016-11-10 11:02 ` Stefan Hajnoczi
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).