mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 08:27:39 +00:00
check for malloc failure
This commit is contained in:
parent
bf309fb554
commit
fedea4a5e1
1 changed files with 2 additions and 0 deletions
|
@ -287,6 +287,8 @@ MSG_ReadString (msg_t *msg)
|
||||||
msg->badread_string = malloc (len + 1);
|
msg->badread_string = malloc (len + 1);
|
||||||
msg->badread_string_size = 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);
|
strncpy (msg->badread_string, string, len);
|
||||||
msg->badread_string[len] = 0;
|
msg->badread_string[len] = 0;
|
||||||
return msg->badread_string;
|
return msg->badread_string;
|
||||||
|
|
Loading…
Reference in a new issue