From: Maxim Korotkov <korotkov.maxim.s@gmail.com>
To: Aravind Ramesh <aravind.ramesh@wdc.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
Maxim Korotkov <maskorotkov@rasu.ru>,
Maxim Korotkov <korotkov.maxim.s@gmail.com>,
linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH v2] f2fs-tools: fixed incorrect error handling
Date: Mon, 20 Nov 2023 10:55:04 +0300 [thread overview]
Message-ID: <20231120075504.455510-1-korotkov.maxim.s@gmail.com> (raw)
In-Reply-To: <20231120065507.423065-1-korotkov.maxim.s@gmail.com>
Case of failed memory allocation of dev->zone_cap_blocks
doesn't release heap allocated rep
Found by RASU JSC
Fixes: f8410857b7a8(f2fs-tools: zns zone-capacity support)
Signed-off-by: Maxim Korotkov <maskorotkov@rasu.ru>
---
changeset:
- editted description
lib/libf2fs_zoned.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c
index 56c97d1..81088af 100644
--- a/lib/libf2fs_zoned.c
+++ b/lib/libf2fs_zoned.c
@@ -293,6 +293,7 @@ int f2fs_check_zones(int j)
dev->zone_cap_blocks = malloc(dev->nr_zones * sizeof(size_t));
if (!dev->zone_cap_blocks) {
+ free(rep);
ERR_MSG("No memory for zone capacity list.\n");
return -ENOMEM;
}
--
2.34.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2023-11-20 7:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 6:55 [f2fs-dev] [PATCH] f2fs-tools: fixed incorrect error handling Maxim Korotkov
2023-11-20 7:55 ` Maxim Korotkov [this message]
2023-11-28 6:24 ` [f2fs-dev] [PATCH v2] " Chao Yu
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=20231120075504.455510-1-korotkov.maxim.s@gmail.com \
--to=korotkov.maxim.s@gmail.com \
--cc=aravind.ramesh@wdc.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=maskorotkov@rasu.ru \
/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;
as well as URLs for NNTP newsgroup(s).