]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
libxl: Don't free domain death event
authorJim Fehlig <jfehlig@suse.com>
Tue, 15 Jan 2013 22:50:35 +0000 (15:50 -0700)
committerJim Fehlig <jfehlig@suse.com>
Wed, 16 Jan 2013 17:13:26 +0000 (10:13 -0700)
Callers should not free death events provided by libxl_evdisable_FOO().

src/libxl/libxl_driver.c

index 591ade27699527bbdd690cb7109840967e2cb058..d26055e9fe33269f63d8f14ec1a94836ef8b168e 100644 (file)
@@ -270,7 +270,6 @@ libxlDomainObjPrivateAlloc(void)
         return NULL;
 
     libxl_ctx_alloc(&priv->ctx, LIBXL_VERSION, 0, libxl_driver->logger);
-    priv->deathW = NULL;
     libxl_osevent_register_hooks(priv->ctx, &libxl_event_callbacks, priv);
 
     return priv;
@@ -281,10 +280,8 @@ libxlDomainObjPrivateFree(void *data)
 {
     libxlDomainObjPrivatePtr priv = data;
 
-    if (priv->deathW) {
+    if (priv->deathW)
         libxl_evdisable_domain_death(priv->ctx, priv->deathW);
-        VIR_FREE(priv->deathW);
-    }
 
     libxl_ctx_free(priv->ctx);
     VIR_FREE(priv);
@@ -604,9 +601,10 @@ libxlCreateDomEvents(virDomainObjPtr vm)
     return 0;
 
 error:
-    if (priv->deathW)
+    if (priv->deathW) {
         libxl_evdisable_domain_death(priv->ctx, priv->deathW);
-    VIR_FREE(priv->deathW);
+        priv->deathW = NULL;
+    }
     return -1;
 }