diff options
author | Marti Maria <marti.maria@littlecms.com> | 2022-08-11 21:37:33 +0300 |
---|---|---|
committer | Marti Maria <marti.maria@littlecms.com> | 2022-08-11 21:37:33 +0300 |
commit | a6ef58ec3716bad934d0cacc063ef1a419f4668f (patch) | |
tree | ea4aba9acd78bbf63a0ff9b5c67e8a17e5abe784 | |
parent | 80a994685f6507e8d0cdbc69822ab0700e301810 (diff) |
make check safer
Move check outside conditional block
-rw-r--r-- | src/cmscgats.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cmscgats.c b/src/cmscgats.c index 52ea255..72958a8 100644 --- a/src/cmscgats.c +++ b/src/cmscgats.c @@ -995,8 +995,10 @@ void InSymbol(cmsIT8* it8) if(FileNest == NULL) { FileNest = it8 ->FileStack[it8 -> IncludeSP + 1] = (FILECTX*)AllocChunk(it8, sizeof(FILECTX)); - //if(FileNest == NULL) - // TODO: how to manage out-of-memory conditions? + if (FileNest == NULL) { + SynError(it8, "Out of memory"); + return; + } } if (BuildAbsolutePath(StringPtr(it8->str), @@ -1170,10 +1172,11 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size) it8 ->Allocator.BlockSize = size; it8 ->Allocator.Used = 0; - it8 ->Allocator.Block = (cmsUInt8Number*) AllocBigBlock(it8, it8 ->Allocator.BlockSize); - if (it8->Allocator.Block == NULL) return NULL; + it8 ->Allocator.Block = (cmsUInt8Number*) AllocBigBlock(it8, it8 ->Allocator.BlockSize); } + if (it8->Allocator.Block == NULL) return NULL; + ptr = it8 ->Allocator.Block + it8 ->Allocator.Used; it8 ->Allocator.Used += size; |