# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1243585609 -3600
# Node ID ae5bd69227d14e27bdd6753b9d21504a0b0242be
# Parent 527b628b8e83d2f85e22892e843dee75978c9d5f
Free pirq_array/pirq_to_evtchn in complete_domain_destroy().
Also rejig code slightly in domain_create().
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/common/domain.c | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff -r 527b628b8e83 -r ae5bd69227d1 xen/common/domain.c
--- a/xen/common/domain.c Fri May 29 09:22:50 2009 +0100
+++ b/xen/common/domain.c Fri May 29 09:26:49 2009 +0100
@@ -255,19 +255,20 @@ struct domain *domain_create(
d->is_paused_by_controller = 1;
atomic_inc(&d->pause_count);
- d->nr_pirqs = nr_irqs +
- (domid ? extra_domU_irqs :
- extra_dom0_irqs ?: nr_irqs);
+ d->nr_pirqs = (nr_irqs +
+ (domid ? extra_domU_irqs :
+ extra_dom0_irqs ?: nr_irqs));
+ d->pirq_to_evtchn = xmalloc_array(u16, d->nr_pirqs);
+ d->pirq_mask = xmalloc_array(
+ unsigned long, BITS_TO_LONGS(d->nr_pirqs));
+ if ( (d->pirq_to_evtchn == NULL) || (d->pirq_mask == NULL) )
+ goto fail;
+ memset(d->pirq_to_evtchn, 0, d->nr_pirqs * sizeof(*d->pirq_to_evtchn));
+ bitmap_zero(d->pirq_mask, d->nr_pirqs);
+
if ( evtchn_init(d) != 0 )
goto fail;
init_status |= INIT_evtchn;
- d->pirq_to_evtchn = xmalloc_array(u16, d->nr_pirqs);
- d->pirq_mask = xmalloc_array(unsigned long,
- BITS_TO_LONGS(d->nr_pirqs));
- if ( !d->pirq_to_evtchn || !d->pirq_mask )
- goto fail;
- memset(d->pirq_to_evtchn, 0, d->nr_pirqs * sizeof(*d->pirq_to_evtchn));
- bitmap_zero(d->pirq_mask, d->nr_pirqs);
if ( grant_table_create(d) != 0 )
goto fail;
@@ -310,15 +311,13 @@ struct domain *domain_create(
if ( init_status & INIT_gnttab )
grant_table_destroy(d);
if ( init_status & INIT_evtchn )
- {
- xfree(d->pirq_mask);
- xfree(d->pirq_to_evtchn);
evtchn_destroy(d);
- }
if ( init_status & INIT_rangeset )
rangeset_domain_destroy(d);
if ( init_status & INIT_xsm )
xsm_free_security_domain(d);
+ xfree(d->pirq_mask);
+ xfree(d->pirq_to_evtchn);
free_domain_struct(d);
return NULL;
}
@@ -603,6 +602,9 @@ static void complete_domain_destroy(stru
if ( d->target != NULL )
put_domain(d->target);
+ xfree(d->pirq_mask);
+ xfree(d->pirq_to_evtchn);
+
xsm_free_security_domain(d);
free_domain_struct(d);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|