From: Steven Rostedt <rostedt@goodmis.org>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] scripts/sorttable: Fix resource leak on file pointer fp
Date: Wed, 26 Feb 2025 18:20:18 -0500 [thread overview]
Message-ID: <20250226182018.0389f561@gandalf.local.home> (raw)
In-Reply-To: <20250226224934.594983-1-colin.i.king@gmail.com>
On Wed, 26 Feb 2025 22:49:34 +0000
Colin Ian King <colin.i.king@gmail.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@gmail.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);
>
next prev parent reply other threads:[~2025-02-26 23:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 22:49 Colin Ian King
2025-02-26 23:20 ` Steven Rostedt [this message]
2025-02-27 9:57 ` Dan Carpenter
2025-02-27 9:58 ` Colin King (gmail)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250226182018.0389f561@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=catalin.marinas@arm.com \
--cc=colin.i.king@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®