cubiomes
cubiomes copied to clipboard
Forgot to check nullptr? Or is it intentional?
So, you have an allocCache() function in generator.c, which calls calloc:
int *allocCache(const Generator *g, Range r)
{
size_t len = getMinCacheSize(g, r.scale, r.sx, r.sy, r.sz);
if (len == 0)
return NULL;
return (int*) calloc(len, sizeof(int));
}
calloc sometimes fails to allocate memory (OOM???) and returns null.
I've changed allocCache() function so that it would not perform any allocations and just return null all the time. The example code at README.md failed immediately (segmentation fault) after that. Briefly looking through this project's code, it seems like you don't check this null value anywhere.
Is it intentional or a genuine issue?