diff options
author | Zhiqiang Liu <liuzhiqiang26@huawei.com> | 2021-02-20 16:41:29 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-02-25 12:02:24 -0500 |
commit | 989a4189698c4efa53b521b6ad8236bbfc3452c3 (patch) | |
tree | 5664ade0ac72d8d71c634ee3cd50e815d58a161c | |
parent | ed907b1df27111bb717e2aba7492547977c63049 (diff) | |
download | e2fsprogs-989a4189698c4efa53b521b6ad8236bbfc3452c3.tar.gz |
debugfs: fix memory leak problem in read_list()
In read_list func, if strtoull() fails in while loop,
we will return the error code directly. Then, memory of
variable lst will be leaked without setting to *list.
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: linfeilong <linfeilong@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | debugfs/util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/debugfs/util.c b/debugfs/util.c index be6b550e4..9e8805481 100644 --- a/debugfs/util.c +++ b/debugfs/util.c @@ -530,12 +530,16 @@ errcode_t read_list(char *str, blk64_t **list, size_t *len) errno = 0; y = x = strtoull(tok, &e, 0); - if (errno) - return errno; + if (errno) { + retval = errno; + break; + } if (*e == '-') { y = strtoull(e + 1, NULL, 0); - if (errno) - return errno; + if (errno) { + retval = errno; + break; + } } else if (*e != 0) { retval = EINVAL; break; |