// load guest image into user memory
guest_img.guest_data = malloc(guest_img.size);
+ if (!guest_img.guest_data) {
+ printf("ERROR: could not allocate memory for guest image\n");
+ return -1;
+ }
read_file(guest_fd, guest_img.size, guest_img.guest_data);
// load guest image into user memory
guest_img.guest_data = malloc(guest_img.size);
+ if (!guest_img.guest_data) {
+ printf("ERROR: could not allocate memory for guest image\n");
+ return -1;
+ }
+
read_file(guest_fd, guest_img.size, guest_img.guest_data);
// load guest image into user memory
guest_img.guest_data = malloc(guest_img.size);
+ if (!guest_img.guest_data) {
+ printf("ERROR: Could not allocate memory for guest image\n");
+ return -1;
+ }
read_file(guest_fd, guest_img.size, guest_img.guest_data);
if (tmp_str[len] == '\n')
tmp_str[len] = 0;
strings[i] = (char*)malloc(MAX_STRING_LEN);
+ if (!strings[i]) {
+ fprintf(stderr, "Error allocating space for variable\n");
+ return -1;
+ }
strcpy(strings[i], tmp_str);
i++;
}
if (bitmap_entries % 8) size++;
bitmap = malloc(size);
+ if (!bitmap) {
+ printf("ERROR: could not allocate space for bitmap\n");
+ return -1;
+ }
+
memset(bitmap, 0, size);
for (i = 0; j < bitmap_entries - 1; i++) {
//
// now built a response
*resp = malloc(sizeof(struct palacios_host_dev_host_request_response) + datasize);
+ if (!*resp) {
+ fprintf(stderr, "ERROR: could not allocate memory for response\n");
+ return -1;
+ }
(*resp)->data_len = sizeof(struct palacios_host_dev_host_request_response) + datasize;
//
// now built a response
*resp = malloc(sizeof(struct palacios_user_keyed_stream_op) + datasize);
+ if (!*resp) {
+ fprintf(stderr, "ERROR: could not allocate space for response\n");
+ return -1;
+ }
+
(*resp)->len = sizeof(struct palacios_user_keyed_stream_op) + datasize;
(*resp)->buf_len = datasize;
(*resp)->type = req->type;