From 0fb61c9eaa36cc86ca58c99e9522334b9e5fbde6 Mon Sep 17 00:00:00 2001 From: Daan Leijen Date: Mon, 18 Oct 2021 16:25:10 -0700 Subject: [PATCH] do not call exit if try handler fails but use abort instead --- src/alloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index 8acff783..f692f495 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -826,7 +826,10 @@ static std_new_handler_t mi_get_new_handler() { static bool mi_try_new_handler(bool nothrow) { std_new_handler_t h = mi_get_new_handler(); if (h==NULL) { - if (!nothrow) exit(ENOMEM); // cannot throw in plain C, use exit as we are out of memory anyway. + if (!nothrow) { + _mi_error_message(EFAULT, "out of memory in 'new' call"); // cannot throw in plain C, use EFAULT to abort + abort(); + } return false; } else {