about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-09-01 16:01:42 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-09-01 16:01:42 +0200
commitadc6cd77b77d2eb899f3b946b816e32e747f8255 (patch)
treee0acc78d9ee4a273eb75f290da942775a2cdf650
parent1b4db8ed14c251f06c9722aa13183d5ba89bf6ce (diff)
downloadfail-adc6cd77b77d2eb899f3b946b816e32e747f8255.tar.gz
fail-adc6cd77b77d2eb899f3b946b816e32e747f8255.tar.xz
fail-adc6cd77b77d2eb899f3b946b816e32e747f8255.zip
oom: exit with 3 when malloc returns 0
-rw-r--r--fail.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fail.c b/fail.c
index 207854a..0ecde49 100644
--- a/fail.c
+++ b/fail.c
@@ -48,6 +48,10 @@ oom()
 
 	while (1) {
 		long *m = malloc(4096*4096);
+		if (!m) {
+			write(1, "\n", 1);
+			exit(3);
+		}
 		m[0] = last;
 		m[1] = c++;
 		last = (long)m;