malloc() may return NULL.

Obtained from:	KAME
MFC after:	1 week
This commit is contained in:
Hajimu UMEMOTO 2003-08-12 16:58:32 +00:00
parent 5912967938
commit d7f0819bf0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118831

View File

@ -112,6 +112,11 @@ getconfig(intface)
} }
tmp = (struct rainfo *)malloc(sizeof(*ralist)); tmp = (struct rainfo *)malloc(sizeof(*ralist));
if (tmp == NULL) {
syslog(LOG_INFO, "<%s> %s: can't allocate enough memory",
__func__, intface);
exit(1);
}
memset(tmp, 0, sizeof(*tmp)); memset(tmp, 0, sizeof(*tmp));
tmp->prefix.next = tmp->prefix.prev = &tmp->prefix; tmp->prefix.next = tmp->prefix.prev = &tmp->prefix;
tmp->route.next = tmp->route.prev = &tmp->route; tmp->route.next = tmp->route.prev = &tmp->route;