Whamcloud - gitweb
e2fsck: handle malloc() failure when computing the log file name
authorzhanchengbin <zhanchengbin1@huawei.com>
Fri, 31 Dec 2021 07:41:41 +0000 (15:41 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 May 2022 00:54:30 +0000 (20:54 -0400)
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>
e2fsck/logfile.c

index 63e9a12..7bdeae1 100644 (file)
@@ -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;
 }