virtio-gpu-3d: fix memory leak in resource attach backing
If the virgl_renderer_resource_attach_iov function fails the 'res_iovs' will be leaked. Add check of the return value to free the 'res_iovs' when failing. Signed-off-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 1482999086-59795-1-git-send-email-liq3ea@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
b8e23926c5
commit
33243031da
@ -291,8 +291,11 @@ static void virgl_resource_attach_backing(VirtIOGPU *g,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
virgl_renderer_resource_attach_iov(att_rb.resource_id,
|
ret = virgl_renderer_resource_attach_iov(att_rb.resource_id,
|
||||||
res_iovs, att_rb.nr_entries);
|
res_iovs, att_rb.nr_entries);
|
||||||
|
|
||||||
|
if (ret != 0)
|
||||||
|
virtio_gpu_cleanup_mapping_iov(res_iovs, att_rb.nr_entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virgl_resource_detach_backing(VirtIOGPU *g,
|
static void virgl_resource_detach_backing(VirtIOGPU *g,
|
||||||
|
Loading…
Reference in New Issue
Block a user