core: Handle array add failures
core: Handle array add failures

This can leak memory but the code to avoid a memory leak is horrible.
Failure on memory allocation in this path is a good candidate for
abort.

sofar/buxton,sofar/buxton