{
struct jailhouse_preload_image *image;
struct jailhouse_new_cell *cell;
- unsigned int images, arg_num;
+ unsigned int images, arg_num, n;
size_t size;
int err, fd;
char *endp;
cell->num_preload_images = images;
arg_num = 4;
- image = cell->image;
- while (images > 0) {
+ for (n = 0, image = cell->image; n < images; n++, image++) {
image->source_address =
(unsigned long)read_file(argv[arg_num++], &size);
image->size = size;
arg_num += 2;
}
image++;
- images--;
}
fd = open_dev();
close(fd);
free((void *)(unsigned long)cell->config_address);
- free((void *)(unsigned long)image->source_address);
+ for (n = 0, image = cell->image; n < images; n++, image++)
+ free((void *)(unsigned long)image->source_address);
free(cell);
return err;