FIX safe realloc; add comment