Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mm2/Little-CMS
Browse files Browse the repository at this point in the history
  • Loading branch information
mm2 committed Nov 3, 2023
2 parents 10104ef + c58f881 commit 282c96e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/cmserr.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ cmsBool _cmsRegisterMemHandlerPlugin(cmsContext ContextID, cmsPluginBase* Plug
static
void* _cmsMallocDefaultFn(cmsContext ContextID, cmsUInt32Number size)
{
if (size > MAX_MEMORY_FOR_ALLOC) return NULL; // Never allow over maximum
// Never allow 0 or over maximum
if (size == 0 || size > MAX_MEMORY_FOR_ALLOC) return NULL;

return (void*) malloc(size);

Expand Down
7 changes: 4 additions & 3 deletions src/cmsnamed.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,15 +817,16 @@ void CMSEXPORT cmsFreeProfileSequenceDescription(cmsSEQ* pseq)
if (pseq == NULL)
return;

for (i=0; i < pseq ->n; i++) {
if (pseq->seq != NULL) {
if (pseq ->seq != NULL) {
for (i=0; i < pseq ->n; i++) {
if (pseq ->seq[i].Manufacturer != NULL) cmsMLUfree(pseq ->seq[i].Manufacturer);
if (pseq ->seq[i].Model != NULL) cmsMLUfree(pseq ->seq[i].Model);
if (pseq ->seq[i].Description != NULL) cmsMLUfree(pseq ->seq[i].Description);
}

_cmsFree(pseq ->ContextID, pseq ->seq);
}

if (pseq ->seq != NULL) _cmsFree(pseq ->ContextID, pseq ->seq);
_cmsFree(pseq -> ContextID, pseq);
}

Expand Down
3 changes: 3 additions & 0 deletions src/cmsvirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,9 @@ cmsHPROFILE CMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, cmsFloat

_cmsAssert(hTransform != NULL);

// Check if the pipeline holding is valid
if (xform -> Lut == NULL) return NULL;

// Get the first mpe to check for named color
mpe = cmsPipelineGetPtrToFirstStage(xform ->Lut);

Expand Down

0 comments on commit 282c96e

Please sign in to comment.