Fix CID 1372600, possible NULL pointer dereference should

reallocarray() fail.

Reported by:	Coverity CID 1372600
MFC after:	1 week
This commit is contained in:
Cy Schubert 2017-04-16 01:15:37 +00:00
parent a07d9e9af4
commit ea5e026a0d

View File

@ -2195,6 +2195,10 @@ char *phrase;
for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL;
s = strtok(NULL, " \r\n\t"), i++) {
fb = reallocarray(fb, i / 4 + 1, sizeof(*fb));
if (fb == NULL) {
perror("memory allocation error at __LINE__ in __FUNCTION__ in __FILE");
abort();
}
l = (u_32_t)strtol(s, NULL, 0);
switch (i & 3)
{