Avoid malloc of zero bytes, add a check and avoid it.