Alloc: proper handling for null values in both alloc and free.