From 8698212b96683b2d46df60b2ea138b11fc3bb6ce Mon Sep 17 00:00:00 2001 From: Irek Fakhrutdinov Date: Fri, 16 Aug 2024 23:23:14 +0200 Subject: [PATCH] SLHAlloc must return NULL when internal allocations fail The SLHAlloc function keeps using the results of the internal allocations even when they're NULL which leads to S0C4 ABENDs. This commit makes SLHAlloc return NULL when the internal allocations fail. Signed-off-by: Irek Fakhrutdinov --- CHANGELOG.md | 1 + c/utils.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed13c6370..18c77e22d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## `2.18.1` - Bugfix: IARV64 results must be checked for 0x7FFFF000 (#474) +- Bugfix: SLH should not ABEND when MEMLIMIT is reached (additional NULL check) ## `2.18.0` - Minor `components.zss.logLevels._zss.httpserver=5` debug messages enhancement (#471) diff --git a/c/utils.c b/c/utils.c index a1feb7c6e..b48b1268f 100644 --- a/c/utils.c +++ b/c/utils.c @@ -1502,6 +1502,7 @@ char *SLHAlloc(ShortLivedHeap *slh, int size){ safeMalloc31(size+4,"SLH Oversize Extend")); if (bigBlock == NULL){ reportSLHFailure(slh,size); + return NULL; } int *sizePtr = (int*)bigBlock; *sizePtr = size; @@ -1528,6 +1529,7 @@ char *SLHAlloc(ShortLivedHeap *slh, int size){ safeMalloc31(slh->blockSize+4,"SLH Extend") ); if (data == NULL){ reportSLHFailure(slh,size); + return NULL; } int *sizePtr = (int*)data; *sizePtr = slh->blockSize;