Re: [PATCH 1/5] kexec: Adding missing free for kernel_buf

2023-05-05 Thread Simon Horman
On Fri, May 05, 2023 at 10:54:33AM +0800, Pingfan Liu wrote:
> slurp_decompress_file() allocates memory but nowhere to free it.
> Adding that missing free.

Hi Pingfan,

There seem to be:

a) other places where slurp_decompress_file() is called and;
b) other places where do_kexec_file_load() returns.

I wonder if a more comprehensive fix appropriate.

> 
> Signed-off-by: Pingfan Liu 
> To: kexec@lists.infradead.org
> Cc: ho...@verge.net.au
> Cc: a...@kernel.org
> Cc: jeremy.lin...@arm.com
> ---
>  kexec/kexec.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kexec/kexec.c b/kexec/kexec.c
> index 36bb2ad..614cd1d 100644
> --- a/kexec/kexec.c
> +++ b/kexec/kexec.c
> @@ -1379,6 +1379,7 @@ static int do_kexec_file_load(int fileind, int argc, 
> char **argv,
>   }
>   }
>  
> + free(kernel_buf);
>   close(kernel_fd);
>   return ret;
>  }
> -- 
> 2.31.1
> 

___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec


[PATCH 1/5] kexec: Adding missing free for kernel_buf

2023-05-04 Thread Pingfan Liu
slurp_decompress_file() allocates memory but nowhere to free it.
Adding that missing free.

Signed-off-by: Pingfan Liu 
To: kexec@lists.infradead.org
Cc: ho...@verge.net.au
Cc: a...@kernel.org
Cc: jeremy.lin...@arm.com
---
 kexec/kexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 36bb2ad..614cd1d 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1379,6 +1379,7 @@ static int do_kexec_file_load(int fileind, int argc, char 
**argv,
}
}
 
+   free(kernel_buf);
close(kernel_fd);
return ret;
 }
-- 
2.31.1


___
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec