[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] hw/xen: Fix memory leak in libxenstore_open() for Xen
From: |
Anthony PERARD |
Subject: |
[PULL 02/12] hw/xen: Fix memory leak in libxenstore_open() for Xen |
Date: |
Wed, 7 Jun 2023 15:18:29 +0100 |
From: David Woodhouse <dwmw@amazon.co.uk>
There was a superfluous allocation of the XS handle, leading to it
being leaked on both the error path and the success path (where it gets
allocated again).
Spotted by Coverity (CID 1508098).
Fixes: ba2a92db1ff6 ("hw/xen: Add xenstore operations to allow redirection to
internal emulation")
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <20230412185102.441523-3-dwmw2@infradead.org>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
hw/xen/xen-operations.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/xen/xen-operations.c b/hw/xen/xen-operations.c
index 4b78fbf4bd..3d213d28df 100644
--- a/hw/xen/xen-operations.c
+++ b/hw/xen/xen-operations.c
@@ -287,7 +287,7 @@ static void watch_event(void *opaque)
static struct qemu_xs_handle *libxenstore_open(void)
{
struct xs_handle *xsh = xs_open(0);
- struct qemu_xs_handle *h = g_new0(struct qemu_xs_handle, 1);
+ struct qemu_xs_handle *h;
if (!xsh) {
return NULL;
--
Anthony PERARD
- [PULL 00/12] xen queue, Anthony PERARD, 2023/06/07
- [PULL 02/12] hw/xen: Fix memory leak in libxenstore_open() for Xen,
Anthony PERARD <=
- [PULL 03/12] xen: Drop support for Xen versions below 4.7.1, Anthony PERARD, 2023/06/07
- [PULL 06/12] hw/pci/pci.c: Don't leak PCIBus::irq_count[] in pci_bus_irqs(), Anthony PERARD, 2023/06/07
- [PULL 04/12] hw/xen: Fix broken check for invalid state in xs_be_open(), Anthony PERARD, 2023/06/07
- [PULL 01/12] hw/xen: Simplify emulated Xen platform init, Anthony PERARD, 2023/06/07
- [PULL 07/12] hw/isa/piix3: Reuse piix3_realize() in piix3_xen_realize(), Anthony PERARD, 2023/06/07
- [PULL 09/12] hw/isa/piix3: Avoid Xen-specific variant of piix3_write_config(), Anthony PERARD, 2023/06/07
- [PULL 05/12] include/hw/xen/xen: Rename xen_piix3_set_irq() to xen_intx_set_irq(), Anthony PERARD, 2023/06/07
- [PULL 11/12] hw/isa/piix3: Resolve redundant TYPE_PIIX3_XEN_DEVICE, Anthony PERARD, 2023/06/07
- [PULL 12/12] xen-block: fix segv on unrealize, Anthony PERARD, 2023/06/07
- [PULL 08/12] hw/isa/piix3: Wire up Xen PCI IRQ handling outside of PIIX3, Anthony PERARD, 2023/06/07