Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Deallocation bug fix in device manager to allow backing out from VM creation failure
[palacios.git] / palacios / src / palacios / vmm_dev_mgr.c
index c75e633..0904ea1 100644 (file)
@@ -119,7 +119,9 @@ int v3_init_dev_mgr(struct v3_vm_info * vm) {
     mgr->net_table = v3_create_htable(0, dev_hash_fn, dev_eq_fn);
     mgr->char_table = v3_create_htable(0, dev_hash_fn, dev_eq_fn);
     mgr->cons_table = v3_create_htable(0, dev_hash_fn, dev_eq_fn);
-    
+
+    mgr->inited = 1;
+
     return 0;
 }
 
@@ -328,8 +330,17 @@ int v3_load_vm_devices(struct v3_vm_info * vm, struct v3_chkpt * chkpt) {
 static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr);
 
 int v3_deinit_dev_mgr(struct v3_vm_info * vm) {
-    struct vmm_dev_mgr * mgr = &(vm->dev_mgr);
-    
+    struct vmm_dev_mgr * mgr=0;
+
+    if (vm) { 
+       mgr = &(vm->dev_mgr);
+       if (!mgr->inited) { 
+           return 0;
+       }
+    } else {
+       return 0;
+    }
+
     // clear frontend lists
 
     free_frontends(vm, mgr);
@@ -866,7 +877,7 @@ static int free_frontends(struct v3_vm_info * vm, struct vmm_dev_mgr * mgr) {
     struct blk_frontend * tmp_blk = NULL;
 
 
-
+    
     list_for_each_entry_safe(chr, tmp_chr, &(mgr->char_list), char_node) {
        list_del(&(chr->char_node));
        V3_Free(chr);