[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH v2] e500: fix memory leak
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-trivial] [PATCH v2] e500: fix memory leak |
Date: |
Sat, 28 Feb 2015 17:40:26 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 28/02/2015 11:13, Michael Tokarev wrote:
> 28.02.2015 13:08, address@hidden пишет:
>> From: Gonglei <address@hidden>
>>
>> Signed-off-by: Gonglei <address@hidden>
>> ---
>> v2: fix compilation complaint. (mjt)
>> ---
>> hw/ppc/e500.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
>> index 7e17d18..c060b50 100644
>> --- a/hw/ppc/e500.c
>> +++ b/hw/ppc/e500.c
>> @@ -309,8 +309,10 @@ static int ppce500_load_device_tree(MachineState
>> *machine,
>>
>> fdt = load_device_tree(filename, &fdt_size);
>> if (!fdt) {
>> + g_free(filename);
>> goto out;
>> }
>> + g_free(filename);
>> goto done;
>> }
>
>
> How about this?
>
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -308,6 +308,7 @@ static int ppce500_load_device_tree(MachineState *machine,
> }
>
> fdt = load_device_tree(filename, &fdt_size);
> + g_free(filename);
> if (!fdt) {
> goto out;
> }
Reviewed-by: Paolo Bonzini <address@hidden>
See also xilinx_load_device_tree:
/* Try the local "ppc.dtb" override. */
fdt = load_device_tree("ppc.dtb", &fdt_size);
if (!fdt) {
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
if (path) {
fdt = load_device_tree(path, &fdt_size);
g_free(path);
}
}
Paolo