shithub: riscv

Download patch

ref: 2dec35524e1c9205656ef0167f5d7486a3a34302
parent: a284b5709106663cffc04dbee6318a780071ef79
author: mischief <[email protected]>
date: Mon Aug 24 23:06:36 EDT 2015

tput: check sbrk return value

--- a/sys/src/cmd/tput.c
+++ b/sys/src/cmd/tput.c
@@ -36,6 +36,8 @@
 	bc = 0;
 	sec = 0;
 	buf = sbrk(buflen);
+	if(buf == (void*)-1)
+		sysfatal("out of memory");
 	cpid = rfork(RFPROC | RFMEM);
 	if(cpid == 0) {
 		while(1) {