Skip to content

Commit

Permalink
contrib/elf2dmp: Always destroy PA space
Browse files Browse the repository at this point in the history
Destroy PA space even if paging base couldn't be found, fixing memory
leak.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Message-id: 20240307-elf2dmp-v4-11-4f324ad4d99d@daynix.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
akihikodaki authored and pm215 committed Mar 11, 2024
1 parent a6a62ef commit 2aa205f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions contrib/elf2dmp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ int main(int argc, char *argv[])
va_space_create(&vs, &ps, state->cr[3]);
if (!fix_dtb(&vs, &qemu_elf)) {
eprintf("Failed to find paging base\n");
goto out_elf;
goto out_ps;
}

printf("CPU #0 IDT is at 0x%016"PRIx64"\n", state->idt.base);
Expand Down Expand Up @@ -634,7 +634,6 @@ int main(int argc, char *argv[])
unlink(PDB_NAME);
out_ps:
pa_space_destroy(&ps);
out_elf:
QEMU_Elf_exit(&qemu_elf);

return err;
Expand Down

0 comments on commit 2aa205f

Please sign in to comment.