Merge pull request #55 from DeforaNetworks/khorben/malloc-check
Check malloc() for errors
This commit is contained in:
commit
f1ba0ff2f8
@ -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