check for malloc failure

This commit is contained in:
Bill Currie 2001-10-23 17:35:46 +00:00
parent bf309fb554
commit fedea4a5e1
1 changed files with 2 additions and 0 deletions

View File

@ -287,6 +287,8 @@ MSG_ReadString (msg_t *msg)
msg->badread_string = malloc (len + 1);
msg->badread_string_size = len + 1;
}
if (!msg->badread_string)
Sys_Error ("MSG_ReadString: out of memory\n");
strncpy (msg->badread_string, string, len);
msg->badread_string[len] = 0;
return msg->badread_string;