r779: fixed a memory leak in SE

This commit is contained in:
Heng Li 2014-05-16 00:06:34 -04:00
parent a5ad0cff7f
commit f00cc94e1d
3 changed files with 7 additions and 8 deletions

View File

@ -992,14 +992,14 @@ void mem_reg2sam_se(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pa
} else {
for (k = 0; k < aa.n; ++k)
mem_aln2sam(bns, &str, s, aa.n, aa.a, k, m, opt->flag&MEM_F_SOFTCLIP);
for (k = 0; k < aa.n; ++k) {
free(aa.a[k].cigar);
free(aa.a[k].XA);
}
for (k = 0; k < aa.n; ++k) free(aa.a[k].cigar);
free(aa.a);
}
s->sam = str.s;
if (XA) free(XA);
if (XA) {
for (k = 0; k < a->n; ++k) free(XA[k]);
free(XA);
}
}
mem_alnreg_v mem_align1_core(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bns, const uint8_t *pac, int l_seq, char *seq, void *buf)

View File

@ -335,8 +335,7 @@ int mem_sam_pe(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, co
// free XA
for (i = 0; i < 2; ++i) {
if (XA[i]) {
for (j = 0; j < a[i].n; ++j)
free(XA[i][j]);
for (j = 0; j < a[i].n; ++j) free(XA[i][j]);
free(XA[i]);
}
}

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.8-r778-dirty"
#define PACKAGE_VERSION "0.7.8-r779-dirty"
#endif
int bwa_fa2pac(int argc, char *argv[]);