summaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2020-07-29 21:08:33 +0200
committerKlaus Jensen <k.jensen@samsung.com>2020-09-02 08:48:50 +0200
commitf06a6aa9648c0567fda12b75358630b595834490 (patch)
treecb16ed9f110df240498b330aebfe5aec2e834a77 /hw/block
parent13b4463d8b4f46ab69755d1dd74c6a0c957cce08 (diff)
downloadqemu-f06a6aa9648c0567fda12b75358630b595834490.zip
hw/block/nvme: destroy request iov before reuse
Make sure the request iov is destroyed before reuse; fixing a memory leak. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/nvme.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index c04e244677..c2aed4d104 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -569,6 +569,10 @@ static void nvme_rw_cb(void *opaque, int ret)
if (req->qsg.nalloc) {
qemu_sglist_destroy(&req->qsg);
}
+ if (req->iov.nalloc) {
+ qemu_iovec_destroy(&req->iov);
+ }
+
nvme_enqueue_req_completion(cq, req);
}