lkml.org 
[lkml]   [2021]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 3/3] bootconfig: Free xbc_data in xbc_destroy_all()
Date
Free xbc_data memory in xbc_destroy_all() with other data.
Note that this changes the ownership of the passed bootconfig
data.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
lib/bootconfig.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 5ae248b29373..2ba7d945adc9 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -789,6 +789,7 @@ static int __init xbc_verify_tree(void)
*/
void __init xbc_destroy_all(void)
{
+ memblock_free_ptr(xbc_data, xbc_data_size);
xbc_data = NULL;
xbc_data_size = 0;
xbc_node_num = 0;
@@ -810,6 +811,8 @@ void __init xbc_destroy_all(void)
* In error cases, @emsg will be updated with an error message and
* @epos will be updated with the error position which is the byte offset
* of @buf. If the error is not a parser error, @epos will be -1.
+ * Note that the @buf ownership is transferred, so it will be freed
+ * in xbc_destroy_all().
*/
int __init xbc_init(char *buf, const char **emsg, int *epos)
{
\
 
 \ /
  Last update: 2021-09-15 15:21    [W:0.058 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site