]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setterm: use xmalloc()
authorKarel Zak <kzak@redhat.com>
Wed, 6 Apr 2011 09:24:23 +0000 (11:24 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Apr 2011 09:24:23 +0000 (11:24 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/setterm.c

index dbe3995ed3240e9fe792b4caaf60205130a4c5ae..905900e5f057570d35ae4ea87fc63f5d193b2421 100644 (file)
@@ -1183,12 +1183,10 @@ screendump(int vcnum, FILE * F)
        cols = header[1];
        if (rows * cols == 0)
                goto read_error;
-       inbuf = malloc(rows * cols * 2);
-       outbuf = malloc(rows * (cols + 1));
-       if (!inbuf || !outbuf) {
-               fputs(_("Out of memory"), stderr);
-               goto error;
-       }
+
+       inbuf = xmalloc(rows * cols * 2);
+       outbuf = xmalloc(rows * (cols + 1));
+
        if (read(fd, inbuf, rows * cols * 2) != rows * cols * 2)
                goto read_error;
        p = inbuf;