linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seung-Woo Kim <sw0312.kim@samsung.com>
To: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, chao@kernel.org, sw0312.kim@samsung.com
Subject: [RESEND][PATCH 2/2] mkfs.f2fs: fix memory leak in not enough segments error path
Date: Fri,  7 May 2021 20:12:24 +0900	[thread overview]
Message-ID: <20210507111224.29887-2-sw0312.kim@samsung.com> (raw)
In-Reply-To: <20210507111224.29887-1-sw0312.kim@samsung.com>

In not enough segements error path of f2fs_write_check_point_pack(),
cp_payload is not freed. Fix the error path.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 mkfs/f2fs_format.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 3f1fa32a407a..fbecb05b3302 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -723,7 +723,7 @@ static int f2fs_write_check_point_pack(void)
 
 	if (f2fs_get_usable_segments(sb) <= get_cp(overprov_segment_count)) {
 		MSG(0, "\tError: Not enough segments to create F2FS Volume\n");
-		goto free_nat_bits;
+		goto free_cp_payload;
 	}
 	MSG(0, "Info: Overprovision ratio = %.3lf%%\n", c.overprovision);
 	MSG(0, "Info: Overprovision segments = %u (GC reserved = %u)\n",
-- 
2.19.2


  parent reply	other threads:[~2021-05-07 11:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210507110917epcas1p13e027d5e0319629c255524c8c6f6461b@epcas1p1.samsung.com>
2021-05-07 11:12 ` [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat() Seung-Woo Kim
     [not found]   ` <CGME20210507110917epcas1p4a2d7ebd7e2fd8cc630fdf627ad73a003@epcas1p4.samsung.com>
2021-05-07 11:12     ` Seung-Woo Kim [this message]
2021-05-08  6:31       ` [f2fs-dev] [RESEND][PATCH 2/2] mkfs.f2fs: fix memory leak in not enough segments error path Chao Yu
2021-05-08  6:30   ` [f2fs-dev] [RESEND][PATCH 1/2] resize.f2fs: fix memory leak caused by migrate_nat() 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=20210507111224.29887-2-sw0312.kim@samsung.com \
    --to=sw0312.kim@samsung.com \
    --cc=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --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;
as well as URLs for NNTP newsgroup(s).