fwts: opal: fix memory leak of 'buf'.
diff mbox series

Message ID 20190704160806.24763-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • fwts: opal: fix memory leak of 'buf'.
Related show

Commit Message

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

Each iteration is leaking an allocated buffer. Free it.

Addresses-Coverity: ("Resource leak")
Fixes: 80eda6b3aad3 ("fwts/opal: Reserved memory DT validation tests.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/opal/reserv_mem.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alex Hung July 4, 2019, 5:41 p.m. UTC | #1
On 2019-07-04 10:08 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Each iteration is leaking an allocated buffer. Free it.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: 80eda6b3aad3 ("fwts/opal: Reserved memory DT validation tests.")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/opal/reserv_mem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
> index 69233b2c..8708295e 100644
> --- a/src/opal/reserv_mem.c
> +++ b/src/opal/reserv_mem.c
> @@ -234,6 +234,7 @@ static int reserv_mem_limits_test(fwts_framework *fw)
>  				buf);
>  			ok = false;
>  		}
> +		free(buf);
>  
>  		if (skip)
>  			continue;
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu July 24, 2019, 6:27 a.m. UTC | #2
On 7/5/19 12:08 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Each iteration is leaking an allocated buffer. Free it.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: 80eda6b3aad3 ("fwts/opal: Reserved memory DT validation tests.")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/opal/reserv_mem.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
> index 69233b2c..8708295e 100644
> --- a/src/opal/reserv_mem.c
> +++ b/src/opal/reserv_mem.c
> @@ -234,6 +234,7 @@ static int reserv_mem_limits_test(fwts_framework *fw)
>   				buf);
>   			ok = false;
>   		}
> +		free(buf);
>   
>   		if (skip)
>   			continue;
> 

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

Patch
diff mbox series

diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
index 69233b2c..8708295e 100644
--- a/src/opal/reserv_mem.c
+++ b/src/opal/reserv_mem.c
@@ -234,6 +234,7 @@  static int reserv_mem_limits_test(fwts_framework *fw)
 				buf);
 			ok = false;
 		}
+		free(buf);
 
 		if (skip)
 			continue;