From d7f0819bf0003ee27e1d14e330d3bc7c87c90926 Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Tue, 12 Aug 2003 16:58:32 +0000 Subject: [PATCH] malloc() may return NULL. Obtained from: KAME MFC after: 1 week --- usr.sbin/rtadvd/config.c | 5 +++++ 1 file changed, 5 insertions(+) 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;