Ugh of course I screwed up the malloc() test. Fixed a crash on GTK+ since I guess OS X malloc() autofills to 0?
This commit is contained in:
parent
6ae6e91238
commit
ea473a3411
|
@ -71,7 +71,7 @@ void *uiRealloc(void *p, size_t new, const char *type)
|
|||
abort();
|
||||
}
|
||||
s = SIZE(out);
|
||||
if (new <= *s)
|
||||
if (new > *s)
|
||||
memset(((uint8_t *) DATA(out)) + *s, 0, new - *s);
|
||||
*s = new;
|
||||
[allocations removeObject:[NSValue valueWithPointer:p]];
|
||||
|
|
|
@ -64,7 +64,7 @@ void *uiRealloc(void *p, size_t new, const char *type)
|
|||
p = BASE(p);
|
||||
out = g_realloc(p, EXTRA + new);
|
||||
s = SIZE(out);
|
||||
if (new <= *s)
|
||||
if (new > *s)
|
||||
memset(((uint8_t *) DATA(out)) + *s, 0, new - *s);
|
||||
*s = new;
|
||||
if (g_ptr_array_remove(allocations, p) == FALSE)
|
||||
|
|
|
@ -45,6 +45,7 @@ void *uiRealloc(void *_p, size_t size, const char *type)
|
|||
if (p == NULL)
|
||||
return uiAlloc(size, type);
|
||||
arr = heap[p];
|
||||
// TODO does this fill in?
|
||||
arr->resize(size, 0);
|
||||
heap.erase(p);
|
||||
heap[rawBytes(arr)] = arr;
|
||||
|
|
Loading…
Reference in New Issue