diff mbox series

[2/8] microblaze: fix leak of fdevice tree blob

Message ID 1569936988-635-3-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series fix various memory leaks (but not all) | expand

Commit Message

Paolo Bonzini Oct. 1, 2019, 1:36 p.m. UTC
The device tree blob returned by load_device_tree is malloced.
Free it before returning.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/microblaze/boot.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé Oct. 1, 2019, 2:01 p.m. UTC | #1
On 10/1/19 3:36 PM, Paolo Bonzini wrote:
> The device tree blob returned by load_device_tree is malloced.
> Free it before returning.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/microblaze/boot.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
> index bade4d2..d1d7dfb 100644
> --- a/hw/microblaze/boot.c
> +++ b/hw/microblaze/boot.c
> @@ -100,6 +100,7 @@ static int microblaze_load_dtb(hwaddr addr,
>       }
>   
>       cpu_physical_memory_write(addr, fdt, fdt_size);
> +    g_free(fdt);
>       return fdt_size;
>   }
>   
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c
index bade4d2..d1d7dfb 100644
--- a/hw/microblaze/boot.c
+++ b/hw/microblaze/boot.c
@@ -100,6 +100,7 @@  static int microblaze_load_dtb(hwaddr addr,
     }
 
     cpu_physical_memory_write(addr, fdt, fdt_size);
+    g_free(fdt);
     return fdt_size;
 }