Skip to content

Commit 99acb64

Browse files
committed
Fix memory leak in test_realn.
Fix buffer overflow in `sam_parse1`. Fixes #731.
1 parent 0c0623f commit 99acb64

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

sam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ int sam_parse1(kstring_t *s, bam_hdr_t *h, bam1_t *b)
13051305
_get_mem(uint8_t, &t, &str, i);
13061306
memset(t, 0, i);
13071307
for (i = 0; i < c->l_qseq; ++i)
1308-
t[i>>1] |= seq_nt16_table[(int)q[i]] << ((~i&1)<<2);
1308+
t[i>>1] |= seq_nt16_table[(unsigned char)q[i]] << ((~i&1)<<2);
13091309
} else c->l_qseq = 0;
13101310
// qual
13111311
q = _read_token_aux(p);

test/test_realn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,6 @@ int main(int argc, char **argv) {
164164
if (in) hts_close(in);
165165
if (out) hts_close(out);
166166
free(ref_seq);
167+
fai_destroy(fai);
167168
return EXIT_FAILURE;
168169
}

0 commit comments

Comments
 (0)