From: Peter Dinda Date: Sat, 7 Jul 2012 21:28:14 +0000 (-0500) Subject: Fixes to allocation order and functions X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=e8cdea385211e98e5e4830573a7e705c85374c3a;p=palacios.git Fixes to allocation order and functions --- diff --git a/linux_module/main.c b/linux_module/main.c index e37f207..c432e3c 100644 --- a/linux_module/main.c +++ b/linux_module/main.c @@ -124,7 +124,7 @@ static long v3_dev_ioctl(struct file * filp, if (create_palacios_vm(guest) == -1) { ERROR("Palacios: Error creating guest\n"); - palacios_free(guest->img); + vfree(guest->img); palacios_free(guest); return -EFAULT; } diff --git a/palacios/src/palacios/vmm_mem.c b/palacios/src/palacios/vmm_mem.c index ee99811..7c11414 100644 --- a/palacios/src/palacios/vmm_mem.c +++ b/palacios/src/palacios/vmm_mem.c @@ -73,6 +73,11 @@ int v3_init_mem_map(struct v3_vm_info * vm) { map->base_region.host_addr = (addr_t)V3_AllocPages(mem_pages); #endif + if ((void*)map->base_region.host_addr == NULL) { + PrintError("Could not allocate guest memory\n"); + return -1; + } + // Clear the memory... memset(V3_VAddr((void *)map->base_region.host_addr), 0, mem_pages * PAGE_SIZE_4KB); @@ -85,13 +90,6 @@ int v3_init_mem_map(struct v3_vm_info * vm) { map->base_region.unhandled = unhandled_err; - if ((void *)map->base_region.host_addr == NULL) { - PrintError("Could not allocate Guest memory\n"); - return -1; - } - - //memset(V3_VAddr((void *)map->base_region.host_addr), 0xffffffff, map->base_region.guest_end); - v3_register_hypercall(vm, MEM_OFFSET_HCALL, mem_offset_hypercall, NULL); return 0;