From 3491e85a15058e87f0166c179282954c434e9acf Mon Sep 17 00:00:00 2001 From: Denis Mukhin Date: Mon, 23 Jun 2025 10:50:33 +0200 Subject: [PATCH] xen/domain: fix memory leak in domain_create() Fix potential memory leak in domain_create() in late hardware domain case. Fixes: b959f3b820f5 ("xen: introduce hardware domain create flag") Signed-off-by: Denis Mukhin --- xen/common/domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/common/domain.c b/xen/common/domain.c index 434d32901b..8c8f70347a 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -825,7 +825,10 @@ struct domain *domain_create(domid_t domid, /* late_hwdom is only allowed for dom0. */ if ( hardware_domain && hardware_domain->domain_id ) + { + free_domain_struct(d); return ERR_PTR(-EINVAL); + } old_hwdom = hardware_domain; hardware_domain = d;