Skip to content

Commit 4ff9712

Browse files
philmdpm215
authored andcommitted
vhost-user-gpu: Release memory returned by vu_queue_pop() with free()
vu_queue_pop() returns memory that must be freed with free(). Cc: [email protected] Reported-by: Coverity (CID 1421887 ALLOC_FREE_MISMATCH) Suggested-by: Peter Maydell <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> Signed-off-by: Peter Maydell <[email protected]>
1 parent 6329df5 commit 4ff9712

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

contrib/vhost-user-gpu/vhost-user-gpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ vg_handle_ctrl(VuDev *dev, int qidx)
848848
QTAILQ_INSERT_TAIL(&vg->fenceq, cmd, next);
849849
vg->inflight++;
850850
} else {
851-
g_free(cmd);
851+
free(cmd);
852852
}
853853
}
854854
}
@@ -939,7 +939,7 @@ vg_handle_cursor(VuDev *dev, int qidx)
939939
}
940940
vu_queue_push(dev, vq, elem, 0);
941941
vu_queue_notify(dev, vq);
942-
g_free(elem);
942+
free(elem);
943943
}
944944
}
945945

contrib/vhost-user-gpu/virgl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ virgl_write_fence(void *opaque, uint32_t fence)
519519
g_debug("FENCE %" PRIu64, cmd->cmd_hdr.fence_id);
520520
vg_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NODATA);
521521
QTAILQ_REMOVE(&g->fenceq, cmd, next);
522-
g_free(cmd);
522+
free(cmd);
523523
g->inflight--;
524524
}
525525
}

0 commit comments

Comments
 (0)