Ahhh!  Running the code through uncrustify was a moderate mistake which exposed a bug when using the  WRITE_BYTE() macro on a if statement without braces.  This should fix the memory corruption in Bitstream.