From: Colin Ian King <colin.i.king@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Catalin Marinas <catalin.marinas@arm.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] scripts/sorttable: Fix resource leak on file pointer fp
Date: Wed, 26 Feb 2025 22:49:34 +0000 [thread overview]
Message-ID: <20250226224934.594983-1-colin.i.king@gmail.com> (raw)
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.
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);
--
2.47.2
next reply other threads:[~2025-02-26 22:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 22:49 Colin Ian King [this message]
2025-02-26 23:20 ` [PATCH][next] scripts/sorttable: Fix resource leak on file pointer fp Steven Rostedt
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=20250226224934.594983-1-colin.i.king@gmail.com \
--to=colin.i.king@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.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