Don't free if reference is NULL.