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.


Lots of pedantic error checking in Palacios proper, especially for memory
[palacios.git] / palacios / src / devices / simple_pic.c
index 96907df..06b6d01 100644 (file)
@@ -82,12 +82,17 @@ static struct v3_device_ops dev_ops = {
 static int pic_init(struct guest_info * vm, void * cfg_data) {
     struct pic_internal * state = NULL;
     state = (struct pic_internal *)V3_Malloc(sizeof(struct pic_internal));
-    V3_ASSERT(state != NULL);
+
+    if (!state) {
+       PrintError("Cannot allocate in init\n");
+       return -1;
+    }
 
     struct vm_device * dev = v3_allocate_device("SIMPLE_PIC", &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
         PrintError("Could not attach device %s\n", "SIMPLE_PIC");
+       V3_Free(state);
         return -1;
     }