- the timidity safe_malloc functions may not throw exceptions.

There is a high chance of them getting called within the stream servicing function which cannot deal with abnormal conditions, so the only choice here is performing a hard abort.
This commit is contained in:
Christoph Oelckers 2020-01-01 17:34:37 +01:00
commit c24f9b42ba
2 changed files with 13 additions and 3 deletions

View file

@ -39,7 +39,7 @@ void *safe_malloc(size_t count)
auto p = malloc(count);
if (p == nullptr)
{
// I_FatalError("Out of memory");
abort();
}
return p;
}
@ -54,7 +54,7 @@ void *safe_realloc(void *ptr, size_t count)
auto p = realloc(ptr, count);
if (p == nullptr)
{
// I_FatalError("Out of memory");
abort();
}
return p;
}
@ -65,7 +65,7 @@ char *safe_strdup(const char *s)
auto p = strdup(s);
if (p == nullptr)
{
// I_FatalError("Out of memory");
abort();
}
return p;
}