Fix compilation with the Clang compiler.
Fix type mismatches between types in sizeof() in malloc/calloc/realloc calls. This generates a warning in the clang analyzer, designed to catch incorrectly sized memory allocations.

The allocation at bam_plcmd.c:208 is twice as big as it needs to be, and has been fixed.
Free the outer struct last
Merge branch master of git://github.com/leecbaker/samtools

Some of the files in the original PR have moved to the bcftools repository,
and the remaining type mismatches of this kind have been fixed there.