1diff --git a/third_party/lcms2-2.6/src/cmsxform.c b/third_party/lcms2-2.6/src/cmsxform.c 2index eddb9bd..6466d27 100644 3--- a/third_party/lcms2-2.6/src/cmsxform.c 4+++ b/third_party/lcms2-2.6/src/cmsxform.c 5@@ -593,7 +593,10 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, 6 7 // Allocate needed memory 8 _cmsTRANSFORM* p = (_cmsTRANSFORM*) _cmsMallocZero(ContextID, sizeof(_cmsTRANSFORM)); 9- if (!p) return NULL; 10+ if (!p) { 11+ cmsPipelineFree(lut); 12+ return NULL; 13+ } 14 15 // Store the proposed pipeline 16 p ->Lut = lut; 17@@ -643,7 +646,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, 18 if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) { 19 20 cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); 21- _cmsFree(ContextID, p); 22+ cmsDeleteTransform(p); 23 return NULL; 24 } 25 26@@ -673,7 +676,7 @@ _cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut, 27 if (p ->FromInput == NULL || p ->ToOutput == NULL) { 28 29 cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); 30- _cmsFree(ContextID, p); 31+ cmsDeleteTransform(p); 32 return NULL; 33 } 34 35