mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 11:53:39 +08:00
net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs()
Use g_autofree to ensure that `config` is freed when
vhost_vdpa_get_max_queue_pairs() returns.
Reported-by: Coverity (CID 1465228: RESOURCE_LEAK)
Fixes: 402378407d
("vhost-vdpa: multiqueue support")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20211102155157.241034-1-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
0a70bcf18c
commit
cd523a4181
@ -214,7 +214,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
|
||||
static int vhost_vdpa_get_max_queue_pairs(int fd, int *has_cvq, Error **errp)
|
||||
{
|
||||
unsigned long config_size = offsetof(struct vhost_vdpa_config, buf);
|
||||
struct vhost_vdpa_config *config;
|
||||
g_autofree struct vhost_vdpa_config *config = NULL;
|
||||
__virtio16 *max_queue_pairs;
|
||||
uint64_t features;
|
||||
int ret;
|
||||
|
Loading…
Reference in New Issue
Block a user