Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a15d85
)
e2fsck: fix to return ENOMEM in alloc_size_dir()
author
Wang Shilong
<wshilong@ddn.com>
Tue, 26 Nov 2019 09:03:58 +0000
(18:03 +0900)
committer
Theodore Ts'o
<tytso@mit.edu>
Wed, 1 Jan 2020 18:41:34 +0000
(13:41 -0500)
Two memory allocation return check is missed.
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/rehash.c
patch
|
blob
|
history
diff --git
a/e2fsck/rehash.c
b/e2fsck/rehash.c
index
2c908be
..
392cfe9
100644
(file)
--- 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;