qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] vhost-user-input: use free(elem) instead of g_free(elem)


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] vhost-user-input: use free(elem) instead of g_free(elem)
Date: Wed, 20 Nov 2019 10:37:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 11/19/19 12:16 PM, Stefan Hajnoczi wrote:
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 <address@hidden>

Fixes: 06914c97d3a ?
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

---
  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);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]