Fix a few things.  Unbogosify a free(), {,UN}MARK with correct args, and fix count checks.
Fix a few things.  Unbogosify a free(), {,UN}MARK with correct args, and
fix count checks.

Submitted by:	Martin Blapp <mb@imp.ch>

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase