Added null case for free().