lib: fwts_framework: fix memory leak on fw->fdt
diff mbox series

Message ID 20190704160057.8350-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • lib: fwts_framework: fix memory leak on fw->fdt
Related show

Commit Message

Colin King July 4, 2019, 4 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Any data allocated for fw->fdt is not being free'd at the end of the
framework, leading to a memory leak. Free it.

Addresses-Coverity: ("Resource leak")
Fixes: 3b364fca9699 ("devicetree: add infrastructure for device-tree tests")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_framework.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alex Hung July 4, 2019, 5:41 p.m. UTC | #1
On 2019-07-04 10:00 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Any data allocated for fw->fdt is not being free'd at the end of the
> framework, leading to a memory leak. Free it.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: 3b364fca9699 ("devicetree: add infrastructure for device-tree tests")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/src/fwts_framework.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index a84dc295..698fa49a 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -1633,6 +1633,7 @@ tidy_close:
>  	free(fw->olog);
>  	free(fw->json_data_path);
>  	free(fw->json_data_file);
> +	free(fw->fdt);
>  
>  	fwts_list_free_items(&fw->errors_filter_discard, NULL);
>  	fwts_list_free_items(&fw->errors_filter_keep, NULL);
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu July 24, 2019, 6:26 a.m. UTC | #2
On 7/5/19 12:00 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Any data allocated for fw->fdt is not being free'd at the end of the
> framework, leading to a memory leak. Free it.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: 3b364fca9699 ("devicetree: add infrastructure for device-tree tests")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_framework.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index a84dc295..698fa49a 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -1633,6 +1633,7 @@ tidy_close:
>   	free(fw->olog);
>   	free(fw->json_data_path);
>   	free(fw->json_data_file);
> +	free(fw->fdt);
>   
>   	fwts_list_free_items(&fw->errors_filter_discard, NULL);
>   	fwts_list_free_items(&fw->errors_filter_keep, NULL);
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index a84dc295..698fa49a 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -1633,6 +1633,7 @@  tidy_close:
 	free(fw->olog);
 	free(fw->json_data_path);
 	free(fw->json_data_file);
+	free(fw->fdt);
 
 	fwts_list_free_items(&fw->errors_filter_discard, NULL);
 	fwts_list_free_items(&fw->errors_filter_keep, NULL);