Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
f2fs: compress: fix to avoid memory leak on cc->cpages
Browse files Browse the repository at this point in the history
Memory allocated for storing compressed pages' poitner should be
released after f2fs_write_compressed_pages(), otherwise it will
cause memory leak issue.

Signed-off-by: Chao Yu <[email protected]>
Fixes: 4c8ff70 ("f2fs: support data compression")
Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
chaseyu authored and Jaegeuk Kim committed Jul 27, 2020
1 parent ca71e2b commit 7a9e6ac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/f2fs/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,8 @@ int f2fs_write_multi_pages(struct compress_ctx *cc,
err = f2fs_write_compressed_pages(cc, submitted,
wbc, io_type);
cops->destroy_compress_ctx(cc);
kfree(cc->cpages);
cc->cpages = NULL;
if (!err)
return 0;
f2fs_bug_on(F2FS_I_SB(cc->inode), err != -EAGAIN);
Expand Down

0 comments on commit 7a9e6ac

Please sign in to comment.