aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhanchengbin <zhanchengbin1@huawei.com>2021-12-31 15:41:41 +0800
committerTheodore Ts'o <tytso@mit.edu>2022-05-11 20:54:30 -0400
commita26abc5a1e2fff9d679887445d313b4b9f946f64 (patch)
tree5e5c8d83d7b3ad756c784a803667c6acf5638fb4
parent6b0e3bd7bd2f2db3c3993c5d91379ad55e60b51e (diff)
downloade2fsprogs-a26abc5a1e2fff9d679887445d313b4b9f946f64.tar.gz
e2fsck: handle malloc() failure when computing the log file name
Link: https://lore.kernel.org/r/6d2844c7-0fd2-e432-3c7e-bb8de8c8a186@huawei.com Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--e2fsck/logfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/e2fsck/logfile.c b/e2fsck/logfile.c
index 63e9a12f1..7bdeae190 100644
--- a/e2fsck/logfile.c
+++ b/e2fsck/logfile.c
@@ -32,7 +32,7 @@ static void alloc_string(struct string *s, int len)
{
s->s = malloc(len);
/* e2fsck_allocate_memory(ctx, len, "logfile name"); */
- s->len = len;
+ s->len = s->s ? len : 0;
s->end = 0;
}