Check malloc() for errors

This commit is contained in:
Pierre Pronchery 2018-02-26 22:05:24 +01:00
parent ca5fada9f4
commit 7ce41d6bc7

View File

@ -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]));
}