1 diff --git a/third_party/lcms/src/cmstypes.c b/third_party/lcms/src/cmstypes.c 2 index 441d6bb..15199c7 100644 3 --- a/third_party/lcms/src/cmstypes.c 4 +++ b/third_party/lcms/src/cmstypes.c 5 @@ -4203,7 +4203,11 @@ void *Type_MPEmatrix_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io 6 7 cmsFloat32Number v; 8 9 - if (!_cmsReadFloat32Number(io, &v)) return NULL; 10 + if (!_cmsReadFloat32Number(io, &v)) { 11 + _cmsFree(self ->ContextID, Matrix); 12 + _cmsFree(self ->ContextID, Offsets); 13 + return NULL; 14 + } 15 Matrix[i] = v; 16 } 17 18 @@ -4212,7 +4216,11 @@ void *Type_MPEmatrix_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io 19 20 cmsFloat32Number v; 21 22 - if (!_cmsReadFloat32Number(io, &v)) return NULL; 23 + if (!_cmsReadFloat32Number(io, &v)) { 24 + _cmsFree(self ->ContextID, Matrix); 25 + _cmsFree(self ->ContextID, Offsets); 26 + return NULL; 27 + } 28 Offsets[i] = v; 29 } 30 31