Merge pull request #2039 from brodie/brodie/handle-null-on-free Fix places in public free() functions where NULL pointers aren't handled