From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSyIX-0006Xw-Fb for qemu-devel@nongnu.org; Thu, 28 Jul 2016 23:17:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSyIV-0003Al-HJ for qemu-devel@nongnu.org; Thu, 28 Jul 2016 23:17:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSyIV-0003Ad-CA for qemu-devel@nongnu.org; Thu, 28 Jul 2016 23:17:15 -0400 Date: Fri, 29 Jul 2016 06:17:10 +0300 From: "Michael S. Tsirkin" Message-ID: <1469762011-7902-37-git-send-email-mst@redhat.com> References: <1469762011-7902-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1469762011-7902-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 36/41] tests: plug some leaks in virtio-net-test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Stefan Hajnoczi , Eric Blake , Markus Armbruster , Jason Wang From: Marc-Andr=E9 Lureau Found thanks to valgrind. Signed-off-by: Marc-Andr=E9 Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/virtio-net-test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c index a34a939..361506f 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -149,6 +149,7 @@ static void rx_stop_cont_test(const QVirtioBus *bus, = QVirtioDevice *dev, char test[] =3D "TEST"; char buffer[64]; int len =3D htonl(sizeof(test)); + QDict *rsp; struct iovec iov[] =3D { { .iov_base =3D &len, @@ -165,7 +166,8 @@ static void rx_stop_cont_test(const QVirtioBus *bus, = QVirtioDevice *dev, free_head =3D qvirtqueue_add(vq, req_addr, 64, true, false); qvirtqueue_kick(bus, dev, vq, free_head); =20 - qmp("{ 'execute' : 'stop'}"); + rsp =3D qmp("{ 'execute' : 'stop'}"); + QDECREF(rsp); =20 ret =3D iov_send(socket, iov, 2, 0, sizeof(len) + sizeof(test)); g_assert_cmpint(ret, =3D=3D, sizeof(test) + sizeof(len)); @@ -173,8 +175,10 @@ static void rx_stop_cont_test(const QVirtioBus *bus,= QVirtioDevice *dev, /* We could check the status, but this command is more importantly t= o * ensure the packet data gets queued in QEMU, before we do 'cont'. */ - qmp("{ 'execute' : 'query-status'}"); - qmp("{ 'execute' : 'cont'}"); + rsp =3D qmp("{ 'execute' : 'query-status'}"); + QDECREF(rsp); + rsp =3D qmp("{ 'execute' : 'cont'}"); + QDECREF(rsp); =20 qvirtio_wait_queue_isr(bus, dev, vq, QVIRTIO_NET_TIMEOUT_US); memread(req_addr + VNET_HDR_SIZE, buffer, sizeof(test)); @@ -230,8 +234,10 @@ static void pci_basic(gconstpointer data) /* End test */ close(sv[0]); qvirtqueue_cleanup(&qvirtio_pci, &tx->vq, alloc); + qvirtqueue_cleanup(&qvirtio_pci, &rx->vq, alloc); pc_alloc_uninit(alloc); qvirtio_pci_device_disable(dev); + g_free(dev->pdev); g_free(dev); qpci_free_pc(bus); test_end(); --=20 MST