vhost-user-gpu: Release memory returned by vu_queue_pop() with free()
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Mon, 23 Mar 2020 11:29:41 +0000 (12:29 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Wed, 15 Apr 2020 18:00:39 +0000 (19:00 +0100)
vu_queue_pop() returns memory that must be freed with free().

Cc: qemu-stable@nongnu.org
Reported-by: Coverity (CID 1421887 ALLOC_FREE_MISMATCH)
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
contrib/vhost-user-gpu/vhost-user-gpu.c
contrib/vhost-user-gpu/virgl.c

index b45d2019b46bdfac64b59d5702aebd504bfca646..a019d0a9acea61a7629f1c74c79a004530696f59 100644 (file)
@@ -848,7 +848,7 @@ vg_handle_ctrl(VuDev *dev, int qidx)
             QTAILQ_INSERT_TAIL(&vg->fenceq, cmd, next);
             vg->inflight++;
         } else {
-            g_free(cmd);
+            free(cmd);
         }
     }
 }
@@ -939,7 +939,7 @@ vg_handle_cursor(VuDev *dev, int qidx)
         }
         vu_queue_push(dev, vq, elem, 0);
         vu_queue_notify(dev, vq);
-        g_free(elem);
+        free(elem);
     }
 }
 
index 43413e29df9d46739c09d2d501df7859222cca4d..b0bc22c3c13db0e8b0b450dac19df5390afbca26 100644 (file)
@@ -519,7 +519,7 @@ virgl_write_fence(void *opaque, uint32_t fence)
         g_debug("FENCE %" PRIu64, cmd->cmd_hdr.fence_id);
         vg_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NODATA);
         QTAILQ_REMOVE(&g->fenceq, cmd, next);
-        g_free(cmd);
+        free(cmd);
         g->inflight--;
     }
 }