libxl: Fix memory leak if pthread_create fails.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines · Konrad Rzeszutek Wilk
If we fail to create the thread we leak the
shutdown_infostructure.
Nice catch, thanks! ACK and pushed.
Regards,
Jim
Quoted 27 lines
Signed-off-by Konrad Rzeszutek Wilk <[email protected]>--- src/libxl/libxl_domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)src/libxl/libxl_domain.c +2
-1@@ -482,7 +482,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;@@ -535,6 +535,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event)virObjectUnref (cfg);if (vm)virObjectUnlock (vm); +VIR_FREE (shutdown_info); }void