From 9497ebb074dcb2ee42cb6cbfbdd7faae6715e613 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 6 Apr 2011 11:24:23 +0200 Subject: setterm: use xmalloc() Signed-off-by: Karel Zak --- term-utils/setterm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'term-utils/setterm.c') diff --git a/term-utils/setterm.c b/term-utils/setterm.c index dbe3995ed..905900e5f 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; -- cgit v1.2.3-55-g7522