Fix memory leaks as reported by DrMemory and Valgrind.
ARM and probably the rest of the arches have significant memory leaks as they have no release interface. Additionally, DrMemory does not have 64-bit support and thus I can't test the 64-bit version under Windows. Under Linux valgrind supports both 32-bit and 64-bit but there are different macros and code for Linux and Windows.
This commit is contained in:
19
qemu/vl.c
19
qemu/vl.c
@@ -107,15 +107,18 @@ int machine_initialize(struct uc_struct *uc)
|
||||
module_call_init(uc, MODULE_INIT_MACHINE);
|
||||
// this will auto initialize all register objects above.
|
||||
machine_class = find_default_machine(uc, uc->arch);
|
||||
if (machine_class == NULL) {
|
||||
//fprintf(stderr, "No machine specified, and there is no default.\n"
|
||||
// "Use -machine help to list supported machines!\n");
|
||||
return -2;
|
||||
if(!uc->machine_state)
|
||||
{
|
||||
if (machine_class == NULL) {
|
||||
//fprintf(stderr, "No machine specified, and there is no default.\n"
|
||||
// "Use -machine help to list supported machines!\n");
|
||||
return -2;
|
||||
}
|
||||
|
||||
current_machine = MACHINE(uc, object_new(uc, object_class_get_name(
|
||||
OBJECT_CLASS(machine_class))));
|
||||
uc->machine_state = current_machine;
|
||||
}
|
||||
|
||||
current_machine = MACHINE(uc, object_new(uc, object_class_get_name(
|
||||
OBJECT_CLASS(machine_class))));
|
||||
|
||||
current_machine->uc = uc;
|
||||
uc->cpu_exec_init_all(uc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user