[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250226182018.0389f561@gandalf.local.home>
Date: Wed, 26 Feb 2025 18:20:18 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Colin Ian King <colin.i.king@...il.com>
Cc: Catalin Marinas <catalin.marinas@....com>,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] scripts/sorttable: Fix resource leak on file
pointer fp
On Wed, 26 Feb 2025 22:49:34 +0000
Colin Ian King <colin.i.king@...il.com> wrote:
> There is a resource leak on fp on an error return path in function
> parse_symbols that causes a resource leak. Fix this by adding in
> the missing fclose.
This patch has already been sent, and it's not really a leak, as when this
returns -1, it causes the program to exit and that will close all file descriptors.
I said I'll take the other patch as a clean up though.
https://lore.kernel.org/all/20250225053724.74582-1-dheeraj.linuxdev@gmail.com/
-- Steve
>
> Fixes: ef378c3b8233 ("scripts/sorttable: Zero out weak functions in mcount_loc table")
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>
> ---
> scripts/sorttable.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/sorttable.c b/scripts/sorttable.c
> index 7b4b3714b1af..e35abf28d037 100644
> --- a/scripts/sorttable.c
> +++ b/scripts/sorttable.c
> @@ -665,8 +665,10 @@ static int parse_symbols(const char *fname)
>
> addr = strtoull(addr_str, NULL, 16);
> size = strtoull(size_str, NULL, 16);
> - if (add_field(addr, size) < 0)
> + if (add_field(addr, size) < 0) {
> + fclose(fp);
> return -1;
> + }
> }
> fclose(fp);
>
Powered by blists - more mailing lists