34 lines
849 B
Diff
34 lines
849 B
Diff
From 12c415fb0bf4aba496d5be0516e75a54bfca6c54 Mon Sep 17 00:00:00 2001
|
|
From: Theodore Ts'o <tytso@mit.edu>
|
|
Date: Thu, 21 Jan 2021 16:01:14 -0500
|
|
Subject: [PATCH] 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>
|
|
---
|
|
debugfs/util.c | 6 ++----
|
|
1 file changed, 2 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/debugfs/util.c b/debugfs/util.c
|
|
index da3a7ef7..fb05e897 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;
|
|
--
|
|
2.25.1
|
|
|