Added missing malloc failure checks

This commit is contained in:
Landon Curt Noll
2021-02-04 15:28:51 -08:00
parent 229345ade8
commit 8b7e01f426
3 changed files with 18 additions and 2 deletions

4
str.c
View File

@@ -59,6 +59,10 @@ initstr(STRINGHEAD *hp)
{
if (hp->h_list == NULL) {
hp->h_list = (char *)malloc(2000);
if (hp->h_list == NULL) {
math_error("Cannot allocate string header");
/*NOTREACHED*/
}
hp->h_avail = 2000;
hp->h_used = 0;
}