don't forget to close a descriptor on a malloc failure.