From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [PULL 2/3] vhost-user-input: use free(elem) instead of g_free(elem)
Date: Wed, 20 Nov 2019 04:59:37 -0500 [thread overview]
Message-ID: <20191120095904.11384-3-mst@redhat.com> (raw)
In-Reply-To: <20191120095904.11384-1-mst@redhat.com>
From: Stefan Hajnoczi <stefanha@redhat.com>
The virtqueue element returned by vu_queue_pop() is allocated using
malloc(3) by virtqueue_alloc_element(). Use the matching free(3)
function instead of glib's g_free().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20191119111626.112206-1-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
contrib/vhost-user-input/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
index 449fd2171a..ef4b7769f2 100644
--- a/contrib/vhost-user-input/main.c
+++ b/contrib/vhost-user-input/main.c
@@ -77,7 +77,7 @@ static void vi_input_send(VuInput *vi, struct virtio_input_event *event)
len = iov_from_buf(elem->in_sg, elem->in_num,
0, &vi->queue[i].event, sizeof(virtio_input_event));
vu_queue_push(dev, vq, elem, len);
- g_free(elem);
+ free(elem);
}
vu_queue_notify(&vi->dev.parent, vq);
@@ -153,7 +153,7 @@ static void vi_handle_sts(VuDev *dev, int qidx)
0, &event, sizeof(event));
vi_handle_status(vi, &event);
vu_queue_push(dev, vq, elem, len);
- g_free(elem);
+ free(elem);
}
vu_queue_notify(&vi->dev.parent, vq);
--
MST
next prev parent reply other threads:[~2019-11-20 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-20 9:59 [PULL 0/3] virtio, acpi: fixes Michael S. Tsirkin
2019-11-20 9:59 ` [PULL 1/3] libvhost-user: Zero memory allocated for VuVirtqInflightDesc Michael S. Tsirkin
2019-11-20 9:59 ` Michael S. Tsirkin [this message]
2019-11-20 9:59 ` [PULL 3/3] tests: acpi: always retain dumped ACPI tables in case of error Michael S. Tsirkin
2019-11-21 11:27 ` [PULL 0/3] virtio, acpi: fixes Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191120095904.11384-3-mst@redhat.com \
--to=mst@redhat.com \
--cc=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).