From 0a77f7a5fbee586e6a05120b087202b84f1a9dc6 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Mon, 18 Mar 2019 16:29:43 +0100 Subject: Check and set error in cc4group_createTmpMemoryMalloc --- src/cc4group.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cc4group.c b/src/cc4group.c index 43a22b5..85c1be4 100644 --- a/src/cc4group.c +++ b/src/cc4group.c @@ -366,7 +366,14 @@ static void* cc4group_createTmpMemoryMalloc(CC4Group* const this, const size_t s // error checking is left out intentionally. it is the job of the calling function void* ret = malloc(size); - *cleanupJob = (CC4Group_CleanupJob){free, ret}; + if(ret == NULL) + { + SET_ERRNO_ERROR("malloc: allocating tmp memory"); + } + else + { + *cleanupJob = (CC4Group_CleanupJob){free, ret}; + } return ret; } -- cgit v1.2.3-54-g00ecf