diff options
author | Karel Zak | 2011-04-06 11:24:23 +0200 |
---|---|---|
committer | Karel Zak | 2011-04-06 11:24:23 +0200 |
commit | 9497ebb074dcb2ee42cb6cbfbdd7faae6715e613 (patch) | |
tree | 86ad2d8b9be9e4d4cee7a4dc33e3946ec4c45b66 /term-utils/setterm.c | |
parent | setterm: fix variable types, and unused argument warnings (diff) | |
download | kernel-qcow2-util-linux-9497ebb074dcb2ee42cb6cbfbdd7faae6715e613.tar.gz kernel-qcow2-util-linux-9497ebb074dcb2ee42cb6cbfbdd7faae6715e613.tar.xz kernel-qcow2-util-linux-9497ebb074dcb2ee42cb6cbfbdd7faae6715e613.zip |
setterm: use xmalloc()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/setterm.c')
-rw-r--r-- | term-utils/setterm.c | 10 |
1 files changed, 4 insertions, 6 deletions
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; |