fix checking status of malloc/realloc
fix checking status of malloc/realloc

As it turns out, both malloc and realloc on Linux may return either NULL or a
pointer that can be handed to free() if size is zero, at least according to
this source:

https://linux.die.net/man/3/realloc

This means, we make all allocations checks explicit and improve the check, by
additionally checking, that the size was non-zero.

When freeing the list, we also check that items is non-NULL before attempting
to free it.

numba/numba,sklam/numba,jriehl/numba,numba/numba,sklam/numba,cpcloud/numba,seibert/numba,gmarkall/numba,jriehl/numba,gmarkall/numba,stuartarchibald/numba,sklam/numba,cpcloud/numba,IntelLabs/numba,jriehl/numba,IntelLabs/numba,stuartarchibald/numba,stonebig/numba,cpcloud/numba,stuartarchibald/numba,numba/numba,seibert/numba,cpcloud/numba,stuartarchibald/numba,stonebig/numba,seibert/numba,jriehl/numba,gmarkall/numba,jriehl/numba,sklam/numba,IntelLabs/numba,stonebig/numba,stonebig/numba,numba/numba,stuartarchibald/numba,seibert/numba,numba/numba,IntelLabs/numba,IntelLabs/numba,gmarkall/numba,stonebig/numba,cpcloud/numba,sklam/numba,seibert/numba,gmarkall/numba