aboutsummaryrefslogtreecommitdiff
path: root/hw/xen
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2023-04-12 19:50:59 +0100
committerAnthony PERARD <anthony.perard@citrix.com>2023-06-07 15:07:10 +0100
commit8442232eba1b041b379ca5845df8252c1e905e43 (patch)
tree1064b36a9daf094f1b5e9afd3be17be706136d47 /hw/xen
parenteeedfe6c6316e8c0d58becc427e12aceb4cb3ad3 (diff)
downloadqemu-8442232eba1b041b379ca5845df8252c1e905e43.zip
qemu-8442232eba1b041b379ca5845df8252c1e905e43.tar.gz
qemu-8442232eba1b041b379ca5845df8252c1e905e43.tar.bz2
hw/xen: Fix memory leak in libxenstore_open() for Xen
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>
Diffstat (limited to 'hw/xen')
-rw-r--r--hw/xen/xen-operations.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/xen/xen-operations.c b/hw/xen/xen-operations.c
index 4b78fbf..3d213d2 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;