From a2619bb1ff14ae48eb66e7ffbc794e448a52079a Mon Sep 17 00:00:00 2001 From: Jim Fehlig Date: Thu, 16 May 2013 09:38:56 -0600 Subject: [PATCH] libxl: fix leaking libxl events libxl expects the event handler to free the event passed to it. From libxl_event.h: event becomes owned by the application and must be freed, either by event_occurs or later --- src/libxl/libxl_driver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 814856b204..d268eea42a 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -711,10 +711,10 @@ libxlVmReap(libxlDriverPrivatePtr driver, #endif static void -libxlEventHandler(void *data ATTRIBUTE_UNUSED, - VIR_LIBXL_EVENT_CONST libxl_event *event) +libxlEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) { libxlDriverPrivatePtr driver = libxl_driver; + libxlDomainObjPrivatePtr priv = ((virDomainObjPtr)data)->privateData; virDomainObjPtr vm = NULL; virDomainEventPtr dom_event = NULL; libxl_shutdown_reason xl_reason = event->u.domain_shutdown.shutdown_reason; @@ -771,6 +771,8 @@ cleanup: libxlDomainEventQueue(driver, dom_event); libxlDriverUnlock(driver); } + /* Cast away any const */ + libxl_event_free(priv->ctx, (libxl_event *)event); } static const struct libxl_event_hooks ev_hooks = { -- GitLab