[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/20] net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue
From: |
Michael S. Tsirkin |
Subject: |
[PULL 01/20] net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs() |
Date: |
Mon, 15 Nov 2021 11:37:15 -0500 |
From: Stefano Garzarella <sgarzare@redhat.com>
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>
---
net/vhost-vdpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 49ab322511..373b706b90 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -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;
--
MST
- [PULL 00/20] pci,pc,virtio: bugfixes, Michael S. Tsirkin, 2021/11/15
- [PULL 01/20] net/vhost-vdpa: fix memory leak in vhost_vdpa_get_max_queue_pairs(),
Michael S. Tsirkin <=
- [PULL 02/20] softmmu/qdev-monitor: fix use-after-free in qdev_set_id(), Michael S. Tsirkin, 2021/11/15
- [PULL 04/20] vhost: Fix last vq queue index of devices with no cvq, Michael S. Tsirkin, 2021/11/15
- [PULL 06/20] pcie: rename 'native-hotplug' to 'x-native-hotplug', Michael S. Tsirkin, 2021/11/15
- [PULL 05/20] hw/mem/pc-dimm: Restrict NUMA-specific code to NUMA machines, Michael S. Tsirkin, 2021/11/15
- [PULL 07/20] hw/acpi/ich9: Add compat prop to keep HPC bit set for 6.1 machine type, Michael S. Tsirkin, 2021/11/15
- [PULL 08/20] bios-tables-test: Allow changes in DSDT ACPI tables, Michael S. Tsirkin, 2021/11/15
- [PULL 09/20] hw/i386/acpi-build: Deny control on PCIe Native Hot-plug in _OSC, Michael S. Tsirkin, 2021/11/15
- [PULL 10/20] tests: bios-tables-test update expected blobs, Michael S. Tsirkin, 2021/11/15
- [PULL 11/20] virtio: use virtio accessor to access packed descriptor flags, Michael S. Tsirkin, 2021/11/15
- [PULL 12/20] virtio: use virtio accessor to access packed event, Michael S. Tsirkin, 2021/11/15