Skip to content

Commit

Permalink
Follow the recommended order of operations
Browse files Browse the repository at this point in the history
As suggested in
    samtools/htslib#1823 (comment)
first comes hts_idx_destroy() followed by sam_close()
  • Loading branch information
pd3 committed Sep 6, 2024
1 parent 418e7fc commit ca6ebec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mpileup2/mpileup.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ void mpileup_destroy(mpileup_t *mplp)
int i;
for (i=0; i<mplp->nbam; i++)
{
if ( mplp->bam[i].iter ) hts_itr_destroy(mplp->bam[i].iter);
sam_close(mplp->bam[i].fp);
if ( mplp->bam[i].cached_rec ) bam_destroy1(mplp->bam[i].cached_rec);
if ( mplp->bam[i].iter ) hts_itr_destroy(mplp->bam[i].iter);
}
for (i=0; i<mplp->nbam_names; i++) free(mplp->bam_names[i]);
free(mplp->bam);
Expand Down

0 comments on commit ca6ebec

Please sign in to comment.