Patchwork [2/3] ppc405: Fix memory leak

login
register
mail settings
Submitter Stefan Weil
Date Jan. 22, 2011, 12:02 p.m.
Message ID <1295697766-8851-2-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/79997/
State Accepted
Headers show

Comments

Stefan Weil - Jan. 22, 2011, 12:02 p.m.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/ppc405_boards.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Andreas Färber - Jan. 23, 2011, 3:34 p.m.
Am 22.01.2011 um 13:02 schrieb Stefan Weil:

> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Acked-by: Andreas Färber <andreas.faerber@web.de>

> ---
> hw/ppc405_boards.c |    1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c
> index b1d2b94..912757b 100644
> --- a/hw/ppc405_boards.c
> +++ b/hw/ppc405_boards.c
> @@ -560,6 +560,7 @@ static void taihu_405ep_init(ram_addr_t ram_size,
>         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
>         if (filename) {
>             bios_size = load_image(filename,  
> qemu_get_ram_ptr(bios_offset));
> +            qemu_free(filename);
>         } else {
>             bios_size = -1;
>         }

Untested but matches the 405 reference board and New World / Old  
World / PReP then.

Andreas

Patch

diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c
index b1d2b94..912757b 100644
--- a/hw/ppc405_boards.c
+++ b/hw/ppc405_boards.c
@@ -560,6 +560,7 @@  static void taihu_405ep_init(ram_addr_t ram_size,
         filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (filename) {
             bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset));
+            qemu_free(filename);
         } else {
             bios_size = -1;
         }