diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2024-07-31 18:00:19 +0100 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2024-08-01 04:32:00 -0400 |
| commit | 9a45b0761628cc59267b3283a85d15294464ac31 (patch) | |
| tree | 7e7064ecf84fb73a51406422e77b1695943d3843 /hw/net/virtio-net.c | |
| parent | 93829009a685687e2fb48158cb5df18c4eb49d07 (diff) | |
| download | focaccia-qemu-9a45b0761628cc59267b3283a85d15294464ac31.tar.gz focaccia-qemu-9a45b0761628cc59267b3283a85d15294464ac31.zip | |
hw/i386/amd_iommu: Don't leak memory in amdvi_update_iotlb()
In amdvi_update_iotlb() we will only put a new entry in the hash table if to_cache.perm is not IOMMU_NONE. However we allocate the memory for the new AMDVIIOTLBEntry and for the hash table key regardless. This means that in the IOMMU_NONE case we will leak the memory we alloacted. Move the allocations into the if() to the point where we know we're going to add the item to the hash table. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2452 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20240731170019.3590563-1-peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/net/virtio-net.c')
0 files changed, 0 insertions, 0 deletions