Check malloc() for errors
This commit is contained in:
parent
ca5fada9f4
commit
7ce41d6bc7
@ -152,6 +152,9 @@ char *DeepState_CStr(size_t len) {
|
|||||||
DeepState_Abandon("Can't create an SIZE_MAX-length string.");
|
DeepState_Abandon("Can't create an SIZE_MAX-length string.");
|
||||||
}
|
}
|
||||||
char *str = (char *) malloc(sizeof(char) * (len + 1));
|
char *str = (char *) malloc(sizeof(char) * (len + 1));
|
||||||
|
if (NULL == str) {
|
||||||
|
DeepState_Abandon("Can't allocate memory.");
|
||||||
|
}
|
||||||
if (len) {
|
if (len) {
|
||||||
DeepState_SymbolizeData(str, &(str[len - 1]));
|
DeepState_SymbolizeData(str, &(str[len - 1]));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user