提交 a2619bb1 编写于 作者: J Jim Fehlig

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
上级 43b0ff5b
......@@ -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 = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册