More TODO resolution.

This commit is contained in:
Pietro Gagliardi 2015-04-10 18:06:01 -04:00
parent a788c1b212
commit d5da551c8c
1 changed files with 7 additions and 3 deletions

View File

@ -12,8 +12,10 @@ void *uiAlloc(size_t size, const char *type)
void *out; void *out;
out = malloc(size); out = malloc(size);
if (out == NULL) if (out == NULL) {
abort(); // TODO figure this part out fprintf(stderr, "memory exhausted in uiAlloc() allocating %s\n", type);
abort();
}
ZeroMemory(out, size); ZeroMemory(out, size);
if (options.debugLogAllocations) if (options.debugLogAllocations)
fprintf(stderr, "%p alloc %s\n", out, type); fprintf(stderr, "%p alloc %s\n", out, type);
@ -27,8 +29,10 @@ void *uiRealloc(void *p, size_t size, const char *type)
if (p == NULL) if (p == NULL)
return uiAlloc(size, type); return uiAlloc(size, type);
out = realloc(p, size); out = realloc(p, size);
if (out == NULL) if (out == NULL) {
fprintf(stderr, "memory exhausted in uiRealloc() reallocating %s\n", type);
abort(); abort();
}
// TODO zero the extra memory // TODO zero the extra memory
if (options.debugLogAllocations) if (options.debugLogAllocations)
fprintf(stderr, "%p realloc %p\n", p, out); fprintf(stderr, "%p realloc %p\n", p, out);