int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
{
+ int err = -ENOMEM;
+
memset(machine, 0, sizeof(*machine));
map_groups__init(&machine->kmaps, machine);
RB_CLEAR_NODE(&machine->rb_node);
char comm[64];
if (thread == NULL)
- return -ENOMEM;
+ goto out;
snprintf(comm, sizeof(comm), "[guest/%d]", pid);
thread__set_comm(thread, comm, 0);
}
machine->current_tid = NULL;
+ err = 0;
+out:
+ if (err)
+ zfree(&machine->root_dir);
return 0;
}