From 7ce41d6bc7e996d75690f916e12cdf0becc21fbc Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Mon, 26 Feb 2018 22:05:24 +0100 Subject: [PATCH] Check malloc() for errors --- src/lib/DeepState.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 6614750..65204d4 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -152,6 +152,9 @@ char *DeepState_CStr(size_t len) { DeepState_Abandon("Can't create an SIZE_MAX-length string."); } char *str = (char *) malloc(sizeof(char) * (len + 1)); + if (NULL == str) { + DeepState_Abandon("Can't allocate memory."); + } if (len) { DeepState_SymbolizeData(str, &(str[len - 1])); }