Skip to content

Commit

Permalink
Let the IOhandler successfully created by cmsOpenIOhandlerFromMem alw…
Browse files Browse the repository at this point in the history
…ays has a valid Block
  • Loading branch information
x2018 committed Apr 12, 2024
1 parent 6491e2e commit a2862d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmsio0.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ cmsBool MemoryWrite(struct _cms_io_handler* iohandler, cmsUInt32Number size, con
{
FILEMEM* ResData = (FILEMEM*) iohandler ->stream;

if (ResData == NULL) return FALSE; // Housekeeping
if (ResData == NULL || ResData ->Block == NULL) return FALSE; // Housekeeping

// Check for available space. Clip.
if (ResData->Pointer + size > ResData->Size) {
Expand Down Expand Up @@ -275,7 +275,7 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buff

case 'w':
fm = (FILEMEM*) _cmsMallocZero(ContextID, sizeof(FILEMEM));
if (fm == NULL) goto Error;
if (fm == NULL || Buffer == NULL) goto Error;

fm ->Block = (cmsUInt8Number*) Buffer;
fm ->FreeBlockOnClose = FALSE;
Expand Down

0 comments on commit a2862d0

Please sign in to comment.