summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin@peeves.(none)>2013-03-29 08:29:31 -0700
committerRobin Watts <robin.watts@artifex.com>2013-03-29 15:36:58 +0000
commit9cf2d61867375f867e6e80906a571d222bc2cbf3 (patch)
treeb4c59b8d03bf83191622325b4dbe24625f3254da
parent049d634ea6bf2a9bafbf9ddef18464be9caa567f (diff)
downloadlcms2-9cf2d61867375f867e6e80906a571d222bc2cbf3.tar.gz
Memory squeezing fix: LCMS2: AllocateToneCurveStruct
Simply add an extra check on the last allocation to avoid returning a partially built struct.
-rw-r--r--src/cmsgamma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmsgamma.c b/src/cmsgamma.c
index 7471d25..10ca600 100644
--- a/src/cmsgamma.c
+++ b/src/cmsgamma.c
@@ -229,7 +229,8 @@ cmsToneCurve* AllocateToneCurveStruct(cmsContext ContextID, cmsInt32Number nEntr
}
p ->InterpParams = _cmsComputeInterpParams(ContextID, p ->nEntries, 1, 1, p->Table16, CMS_LERP_FLAGS_16BITS);
- return p;
+ if (p->InterpParams != NULL)
+ return p;
Error:
if (p -> Segments) _cmsFree(ContextID, p ->Segments);