# HG changeset patch
# User Patrick Colp <pjcolp@xxxxxxxxx>
# Date 1280265109 25200
# Node ID 5a5bfb95a437cd860ab2da71c6534a2bef8fa558
# Parent 6cb61775657f6ea362b3ff45ed22e67b00ad3ea5
xenpaging: Fix-up xenpaging tool code.
This isn't directly related to EPT checking, but does some general fix-ups
to the xenpaging code (adds some extra frees, etc.)
Signed-off-by: Patrick Colp <pjcolp@xxxxxxxxx>
diff -r 6cb61775657f -r 5a5bfb95a437 tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c Tue Jul 27 14:11:49 2010 -0700
+++ b/tools/xenpaging/xenpaging.c Tue Jul 27 14:11:49 2010 -0700
@@ -73,8 +73,9 @@
xc_interface *xch;
int rc;
- xch = xc_interface_open(0,0,0);
- if ( !xch ) return NULL;
+ xch = xc_interface_open(NULL, NULL, 0);
+ if ( !xch )
+ goto err_iface;
DPRINTF("xenpaging init\n");
*xch_r = xch;
@@ -101,7 +102,7 @@
paging->mem_event.ring_page = init_page();
if ( paging->mem_event.ring_page == NULL )
{
- ERROR("Error initialising shared page");
+ ERROR("Error initialising ring page");
goto err;
}
@@ -199,13 +200,33 @@
return paging;
err:
- if ( paging->bitmap )
- free(paging->bitmap);
- if ( paging->platform_info )
- free(paging->platform_info);
if ( paging )
+ {
+ if ( paging->bitmap )
+ free(paging->bitmap);
+
+ if ( paging->platform_info )
+ free(paging->platform_info);
+
+ if ( paging->domain_info )
+ free(paging->domain_info);
+
+ if ( paging->mem_event.shared_page )
+ {
+ munlock(paging->mem_event.shared_page, PAGE_SIZE);
+ free(paging->mem_event.shared_page);
+ }
+
+ if ( paging->mem_event.ring_page )
+ {
+ munlock(paging->mem_event.ring_page, PAGE_SIZE);
+ free(paging->mem_event.ring_page);
+ }
+
free(paging);
+ }
+ err_iface:
return NULL;
}
@@ -619,6 +640,8 @@
if ( rc == 0 )
rc = rc1;
+ xc_interface_close(xch);
+
return rc;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|