More guarding against freeing NULL pointers.