From f151f3dc2edbc978db4625bfd08ce9c96e2f97b7 Mon Sep 17 00:00:00 2001 From: Andreas Zwinkau Date: Mon, 9 Jan 2012 16:39:07 +0100 Subject: [PATCH] Fix bug with panic("out of memory") The panic function might allocate memory via ir_vfprintf, so we must not use it in the out of memory case. Otherwise we get an infinite loop. --- ir/adt/xmalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ir/adt/xmalloc.c b/ir/adt/xmalloc.c index 12f22374a..4f2ba33da 100644 --- a/ir/adt/xmalloc.c +++ b/ir/adt/xmalloc.c @@ -35,7 +35,8 @@ static NORETURN xnomem(void) { - panic("out of memory"); + /* Do not use panic() here, because it might try to allocate memory! */ + fputs("out of memory", stderr); } void *xmalloc(size_t size) -- 2.20.1