summaryrefslogtreecommitdiff
path: root/nasmlib
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 16:43:43 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 16:43:43 -0800
commitdf2195b6a978448f640cae552858740d214886a4 (patch)
treead9a7198f2b89ad36e6d06fc7bfb560b3fc0ce74 /nasmlib
parentfef75c265a2dafb6482ffd4078f74f2a66fa2535 (diff)
parent3b91f4c117003a9f42717fe88257b6025790169e (diff)
downloadnasm-df2195b6a978448f640cae552858740d214886a4.tar.gz
Merge remote-tracking branch 'origin/nasm-2.14.xx'
Resolved Conflicts: Makefile.in Mkfiles/msvc.mak Mkfiles/openwcom.mak asm/nasm.c nasmlib/alloc.c Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'nasmlib')
-rw-r--r--nasmlib/alloc.c18
-rw-r--r--nasmlib/errfile.c5
2 files changed, 22 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)
diff --git a/nasmlib/errfile.c b/nasmlib/errfile.c
new file mode 100644
index 00000000..ee4bae8e
--- /dev/null
+++ b/nasmlib/errfile.c
@@ -0,0 +1,5 @@
+#include "compiler.h"
+#include <stdio.h>
+
+FILE *error_file;
+