samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
663 stars 240 forks source link

Fix a trivial memory leak in the mpileup usage (etc) code #2108

Closed jkbonfield closed 7 months ago

jkbonfield commented 7 months ago

The main function sets mplp.bsmpl = bam_smpl_init() which allocates memory. This is freed at the end of main_mpileup. Unfortunately there are many ways of exiting this function early which don't do this free. Restructured it slightly so the free happens.

It's not a serious problem, but it did prevent make check from working when using -fsanitize=address. This wasn't spotted via the CI as it doesn't have a PTY and hence it avoids running the usage tests.