diff options
author | Wang Shilong <wshilong@ddn.com> | 2019-11-26 18:03:58 +0900 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2020-01-01 13:41:34 -0500 |
commit | 927ebc78a26cf7d7be09cd0b181c4a11a7a62590 (patch) | |
tree | 9a6600e3a88c7e0253be5967493157eef852a9cc | |
parent | 3a15d85bfb1bb099d6e0455538f93a7088733272 (diff) | |
download | e2fsprogs-927ebc78a26cf7d7be09cd0b181c4a11a7a62590.tar.gz |
e2fsck: fix to return ENOMEM in alloc_size_dir()
Two memory allocation return check is missed.
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | e2fsck/rehash.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c index 2c908be04..392cfe9f1 100644 --- a/e2fsck/rehash.c +++ b/e2fsck/rehash.c @@ -276,7 +276,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; |