summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2005-07-17 20:43:15 +0000
committerBrad Smith <brad@cvs.openbsd.org>2005-07-17 20:43:15 +0000
commitafd22d71df560f8fb66ed5baad0a90a242c3303d (patch)
treebecb0ad705e528293c14393496f8ad7dbdfa4547 /usr.sbin/ppp
parent2d6fc6c4ed002bcf96bf824625cdf3a5b7a40665 (diff)
another malloc() check.
From brian FreeBSD
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/ppp/route.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/ppp/ppp/route.c b/usr.sbin/ppp/ppp/route.c
index 8b2fce9dc41..b045ee693a6 100644
--- a/usr.sbin/ppp/ppp/route.c
+++ b/usr.sbin/ppp/ppp/route.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: route.c,v 1.33 2005/07/17 19:13:25 brad Exp $
+ * $OpenBSD: route.c,v 1.34 2005/07/17 20:43:14 brad Exp $
*/
#include <sys/param.h>
@@ -617,8 +617,13 @@ route_Add(struct sticky_route **rp, int type, const struct ncprange *dst,
rp = &(*rp)->next;
}
- if (!r)
+ if (r == NULL) {
r = (struct sticky_route *)malloc(sizeof(struct sticky_route));
+ if (r == NULL) {
+ log_Printf(LogERROR, "route_Add: Out of memory!\n");
+ return;
+ }
+ }
r->type = type;
r->next = NULL;
ncprange_copy(&r->dst, dst);