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>
This commit is contained in:
Klaus Jensen 2020-07-29 21:08:33 +02:00
parent 13b4463d8b
commit f06a6aa964

View File

@ -569,6 +569,10 @@ static void nvme_rw_cb(void *opaque, int ret)
if (req->qsg.nalloc) { if (req->qsg.nalloc) {
qemu_sglist_destroy(&req->qsg); qemu_sglist_destroy(&req->qsg);
} }
if (req->iov.nalloc) {
qemu_iovec_destroy(&req->iov);
}
nvme_enqueue_req_completion(cq, req); nvme_enqueue_req_completion(cq, req);
} }