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.