Skip to content

Commit

Permalink
Check malloc() for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
khorben committed Feb 26, 2018
1 parent ca5fada commit 7ce41d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/DeepState.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
Expand Down

0 comments on commit 7ce41d6

Please sign in to comment.