diff options
author | Chao Yu <yuchao0@huawei.com> | 2020-07-20 16:52:50 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-07-20 15:47:38 -0700 |
commit | 02772fbfcba8597eef9d5c5f7f94087132d0c1d4 (patch) | |
tree | 50789c24bb6bf0ec39bc6e8af02023b8b6aaab0e /fs/f2fs | |
parent | 3357af8f1a09731b75628f72de76ea8e3c9cbd7e (diff) | |
download | linux-02772fbfcba8597eef9d5c5f7f94087132d0c1d4.tar.gz linux-02772fbfcba8597eef9d5c5f7f94087132d0c1d4.tar.bz2 linux-02772fbfcba8597eef9d5c5f7f94087132d0c1d4.zip |
f2fs: compress: fix to avoid memory leak on cc->cpages
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 <yuchao0@huawei.com>
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/compress.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c index 3a847bc36748..a20c9f3272af 100644 --- a/fs/f2fs/compress.c +++ b/fs/f2fs/compress.c @@ -1385,6 +1385,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); |