smalloc: zero size allocs may need to be free'd

Zero size allocations don't necessarily mean that data == NULL. So
instead check each value seperately and perform necessary operations.