From: Karel Zak Date: Wed, 6 Apr 2011 09:24:23 +0000 (+0200) Subject: setterm: use xmalloc() X-Git-Tag: v2.20-rc1~378 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9497ebb074dcb2ee42cb6cbfbdd7faae6715e613;p=thirdparty%2Futil-linux.git setterm: use xmalloc() Signed-off-by: Karel Zak --- diff --git a/term-utils/setterm.c b/term-utils/setterm.c index dbe3995ed3..905900e5f0 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -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;