Messages in this thread Patch in this message | | | From | Masami Hiramatsu <> | Subject | [PATCH v3 3/3] bootconfig: Free xbc_data in xbc_destroy_all() | Date | Wed, 15 Sep 2021 22:19:52 +0900 |
| |
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) {
| |