summaryrefslogtreecommitdiff
path: root/nasmlib/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'nasmlib/alloc.c')
-rw-r--r--nasmlib/alloc.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/nasmlib/alloc.c b/nasmlib/alloc.c
index 2f3f9519..ad2cff3d 100644
--- a/nasmlib/alloc.c
+++ b/nasmlib/alloc.c
@@ -42,7 +42,23 @@
no_return nasm_alloc_failed(void)
{
- nasm_fatal("out of memory");
+ /* If nasm_fatal() gets us back here, then croak hard */
+ static bool already_here = false;
+ FILE *errfile;
+
+ if (likely(!already_here)) {
+ already_here = true;
+ nasm_fatal("out of memory!");
+ }
+
+ errfile = error_file;
+ if (!errfile)
+ error_file = stderr;
+
+ fprintf(error_file, "nasm: out of memory!\n");
+ fflush(error_file);
+ fflush(NULL);
+ abort();
}
void *nasm_malloc(size_t size)