Put a lower bound on the amount of memory available during malloc testing and shrinking the window.

This commit is contained in:
Con Kolivas 2021-02-15 15:43:06 +11:00
parent a0bacc90ee
commit dd58a58692

View file

@ -985,6 +985,14 @@ retest_malloc:
testmalloc = malloc(testsize);
if (!testmalloc) {
limit = limit / 10 * 9;
if (limit < 100000000) {
/* If we can't even allocate 100MB then we'll never
* succeed */
print_err("Unable to allocate enough memory for operation\n");
dealloc(sinfo->s);
dealloc(sinfo);
return NULL;
}
goto retest_malloc;
}
if (!NO_COMPRESS) {