[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1574759039-7429-1-git-send-email-wangshilong1991@gmail.com>
Date: Tue, 26 Nov 2019 18:03:58 +0900
From: Wang Shilong <wangshilong1991@...il.com>
To: linux-ext4@...r.kernel.org
Cc: adilger@...ger.ca, lixi@....com, wshilong@....com
Subject: [PATCH 1/2] e2fsck: fix to return ENOMEM in alloc_size_dir()
From: Wang Shilong <wshilong@....com>
Two memory allocation return check is missed.
Signed-off-by: Wang Shilong <wshilong@....com>
---
e2fsck/rehash.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index a5fc1be1..5250652e 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -272,7 +272,11 @@ static errcode_t alloc_size_dir(ext2_filsys fs, struct out_dir *outdir,
outdir->hashes = new_mem;
} else {
outdir->buf = malloc(blocks * fs->blocksize);
+ if (!outdir->buf)
+ return ENOMEM;
outdir->hashes = malloc(blocks * sizeof(ext2_dirhash_t));
+ if (!outdir->hashes)
+ return ENOMEM;
outdir->num = 0;
}
outdir->max = blocks;
--
2.21.0
Powered by blists - more mailing lists