samples/mpileup.c, samples/pileup.c, and samples/pileup_mod.c use fp->bam_header directly.
They should remember the header returned from sam_hdr_read() and use it where appropriate rather than directly accessing an undocumented field in the htsFile structure, which is morally opaque.