- SAFE_FREE(indiv->xrefstr);
- SAFE_FREE(indiv->restriction_notice);
- DESTROY_CHAIN_ELTS(personal_name, indiv->name, name_cleanup)
- SAFE_FREE(indiv->sex);
- DESTROY_CHAIN_ELTS(event, indiv->event, event_cleanup)
- DESTROY_CHAIN_ELTS(event, indiv->attribute, event_cleanup)
- DESTROY_CHAIN_ELTS(lds_event, indiv->lds_individual_ordinance,
- lds_event_cleanup)
- DESTROY_CHAIN_ELTS(family_link, indiv->child_to_family, family_link_cleanup)
- DESTROY_CHAIN_ELTS(family_link, indiv->spouse_to_family, family_link_cleanup)
- DESTROY_CHAIN_ELTS(xref_list, indiv->submitters, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(association, indiv->association, association_cleanup)
- DESTROY_CHAIN_ELTS(xref_list, indiv->alias, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(xref_list, indiv->ancestor_interest, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(xref_list, indiv->descendant_interest, NULL_DESTROY)
- DESTROY_CHAIN_ELTS(source_citation, indiv->citation, citation_cleanup)
- DESTROY_CHAIN_ELTS(multimedia_link, indiv->mm_link, multimedia_link_cleanup)
- DESTROY_CHAIN_ELTS(note_sub, indiv->note, note_sub_cleanup)
- SAFE_FREE(indiv->record_file_nr);
- SAFE_FREE(indiv->ancestral_file_nr);
- DESTROY_CHAIN_ELTS(user_ref_number, indiv->ref, user_ref_cleanup)
- SAFE_FREE(indiv->record_id);
- change_date_cleanup(indiv->change_date);
- DESTROY_CHAIN_ELTS(user_data, indiv->extra, user_data_cleanup)
+ if (indiv) {
+ SAFE_FREE(indiv->xrefstr);
+ SAFE_FREE(indiv->restriction_notice);
+ DESTROY_CHAIN_ELTS(personal_name, indiv->name, name_cleanup);
+ SAFE_FREE(indiv->sex);
+ DESTROY_CHAIN_ELTS(event, indiv->event, event_cleanup);
+ DESTROY_CHAIN_ELTS(event, indiv->attribute, event_cleanup);
+ DESTROY_CHAIN_ELTS(lds_event, indiv->lds_individual_ordinance,
+ lds_event_cleanup);
+ DESTROY_CHAIN_ELTS(family_link,indiv->child_to_family,family_link_cleanup);
+ DESTROY_CHAIN_ELTS(family_link,indiv->spouse_to_family,
+ family_link_cleanup);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->submitters, NULL_DESTROY);
+ DESTROY_CHAIN_ELTS(association, indiv->association, association_cleanup);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->alias, NULL_DESTROY);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->ancestor_interest, NULL_DESTROY);
+ DESTROY_CHAIN_ELTS(xref_list, indiv->descendant_interest, NULL_DESTROY);
+ DESTROY_CHAIN_ELTS(source_citation, indiv->citation, citation_cleanup);
+ DESTROY_CHAIN_ELTS(multimedia_link,indiv->mm_link,multimedia_link_cleanup);
+ DESTROY_CHAIN_ELTS(note_sub, indiv->note, note_sub_cleanup);
+ SAFE_FREE(indiv->record_file_nr);
+ SAFE_FREE(indiv->ancestral_file_nr);
+ DESTROY_CHAIN_ELTS(user_ref_number, indiv->ref, user_ref_cleanup);
+ SAFE_FREE(indiv->record_id);
+ change_date_cleanup(indiv->change_date);
+ DESTROY_CHAIN_ELTS(user_data, indiv->extra, user_data_cleanup);
+ }