diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index d49418230083..bb6ba9d43930 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -112,6 +112,11 @@ getconfig(intface) } 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)); tmp->prefix.next = tmp->prefix.prev = &tmp->prefix; tmp->route.next = tmp->route.prev = &tmp->route;