Memory squeezing bug: lcms2 MatrixElemTypeFree

Destructors should cope with NULL.
Memory squeezing fix: lcms2 cmsPipeline construction

When creating a new pipeline, lcms would often try to allocate a stage
and pass it to cmsPipelineInsertStage without checking whether the
allocation succeeded. cmsPipelineInsertStage would then assert (or crash)
if it had not.

The fix here is to change cmsPipelineInsertStage to check and return
an error value. All calling code is then checked to test this return
value and cope.
Memory squeezing fix: LCMS2: AllocateToneCurveStruct

Simply add an extra check on the last allocation to avoid returning a
partially built struct.
Memory squeezing: More LCMS2 fixes.

Fix some broken error code, add some checking where it was missing, and
fix a potential leak.
Merge pull request #13 from robinwatts/memsqueeze_fixes

Memsqueeze fixes