aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2021-01-21 16:01:14 -0500
committerTheodore Ts'o <tytso@mit.edu>2021-01-21 16:01:14 -0500
commit12c415fb0bf4aba496d5be0516e75a54bfca6c54 (patch)
tree1f64abc60812b084d1dee7f03bca9b4349e78b05
parentdd2ed58ab1873304ba2e7d0a0e49ec87981aafc7 (diff)
downloade2fsprogs-12c415fb0bf4aba496d5be0516e75a54bfca6c54.tar.gz
debugfs: fix double free in realloc() error path in read_list()
Fixes-Coverity-Bug: 1464575 Fixes-Coverity-Bug: 1464571 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--debugfs/util.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/debugfs/util.c b/debugfs/util.c
index da3a7ef76..fb05e897b 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -545,10 +545,8 @@ errcode_t read_list(char *str, blk64_t **list, size_t *len)
goto err;
}
l = realloc(lst, sizeof(blk64_t) * (ln + y - x + 1));
- if (l == NULL) {
- retval = ENOMEM;
- goto err;
- }
+ if (l == NULL)
+ return ENOMEM;
lst = l;
for (; x <= y; x++)
lst[ln++] = x;