From 95003cd511b74fe89f374f40d505b89ce37cbce1 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 25 Mar 2015 21:35:11 -0400 Subject: [PATCH] libxl: Fix memory leak if pthread_create fails. If we fail to create the thread we leak the shutdown_info structure. Signed-off-by: Konrad Rzeszutek Wilk --- src/libxl/libxl_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 8feb4dc627..ce9e4d8f39 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -473,7 +473,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) libxlDriverPrivatePtr driver = data; virDomainObjPtr vm = NULL; libxl_shutdown_reason xl_reason = event->u.domain_shutdown.shutdown_reason; - struct libxlShutdownThreadInfo *shutdown_info; + struct libxlShutdownThreadInfo *shutdown_info = NULL; virThread thread; libxlDriverConfigPtr cfg; @@ -526,6 +526,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) virObjectUnref(cfg); if (vm) virObjectUnlock(vm); + VIR_FREE(shutdown_info); } void -- GitLab