* [PATCH] fsck.f2fs: fix double free invalid checkpoint
@ 2015-12-28 11:33 Sheng Yong
0 siblings, 0 replies; only message in thread
From: Sheng Yong @ 2015-12-28 11:33 UTC (permalink / raw)
To: jaegeuk, chao, linux-f2fs-devel
The invalid checkpoin is freed in validate_checkpoint().
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
fsck/mount.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index fe68f37..7533926 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -469,11 +469,8 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
cur_page = cp2;
sbi->cur_cp = 2;
version = cp2_version;
- } else {
- free(cp1);
- free(cp2);
+ } else
goto fail_no_cp;
- }
MSG(0, "Info: CKPT version = %llx\n", version);
@@ -495,8 +492,10 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
memcpy(ckpt + i * blk_size, cur_page, blk_size);
}
}
- free(cp1);
- free(cp2);
+ if (cp1)
+ free(cp1);
+ if (cp2)
+ free(cp2);
return 0;
fail_no_cp:
--
1.9.1
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-28 3:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-28 11:33 [PATCH] fsck.f2fs: fix double free invalid checkpoint Sheng Yong
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).