diff options
author | Wang Shilong <wshilong@ddn.com> | 2020-09-28 10:27:12 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-01-25 15:19:04 -0500 |
commit | d9aa090f713ecf3393c4e68d951a03ccba4a7073 (patch) | |
tree | 95fcdc1b0d4e3d64e13190519cb60b0eb749cfa6 | |
parent | 59ae5e5a627aaa24d663e8ce41955e1ded46633a (diff) | |
download | e2fsprogs-d9aa090f713ecf3393c4e68d951a03ccba4a7073.tar.gz |
e2fsck: fix memory leaks with pfsck enabled
valgrind detected two memory leaks:
1) quota context is not released after merging.
2) @refcount_orig should be released
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/e2fsck.c | 4 | ||||
-rw-r--r-- | e2fsck/pass1.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c index ca314778c..b70aca21e 100644 --- a/e2fsck/e2fsck.c +++ b/e2fsck/e2fsck.c @@ -102,6 +102,10 @@ errcode_t e2fsck_reset_context(e2fsck_t ctx) ea_refcount_free(ctx->refcount_extra); ctx->refcount_extra = 0; } + if (ctx->refcount_orig) { + ea_refcount_free(ctx->refcount_orig); + ctx->refcount_orig = 0; + } if (ctx->ea_block_quota_blocks) { ea_refcount_free(ctx->ea_block_quota_blocks); ctx->ea_block_quota_blocks = 0; diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 4d9cd78a4..0c8bd72f9 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -3111,6 +3111,7 @@ static int e2fsck_pass1_thread_join(e2fsck_t global_ctx, e2fsck_t thread_ctx) fclose(thread_ctx->problem_logf); } + quota_release_context(&thread_ctx->qctx); /* * @block_metadata_map and @block_dup_map are * shared, so we don't free them. |