]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: show size requested when memory allocation fails
authorEric Sandeen <sandeen@redhat.com>
Mon, 7 Jan 2013 21:45:54 +0000 (15:45 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 8 Jan 2013 15:41:08 +0000 (10:41 -0500)
"e2fsck: Can't allocate dx_block info array"
is only so helpful - it'd be nice to know how much it tried to allocate.

In particular, since I think malloc(0) can return NULL,
it'd be nice to know if maybe we passed in an uninitialized (or
0-initialized) size.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/util.c

index a6b9e8644bd3f7d028e170ef4a012d378415641f..2b7d2ff83b34ddc0de21715bde65f6eaa97c6ac5 100644 (file)
@@ -121,7 +121,8 @@ void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
 #endif
        ret = malloc(size);
        if (!ret) {
-               sprintf(buf, "Can't allocate %s\n", description);
+               sprintf(buf, "Can't allocate %u bytes for %s\n",
+                       size, description);
                fatal_error(ctx, buf);
        }
        memset(ret, 0, size);