summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2010-06-01 11:29:30 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2010-06-01 11:29:30 +0000
commitc9f9b3f50210376fb5182de0fc685590177c48ea (patch)
treeb23c21bfe493b0901edd468359c7d934342d3638
parentd16a9b686f613890c2a4cfeeabfd66e483f01f13 (diff)
Add NULL pointer check after calloc.
ok claudio@ stsp@
-rw-r--r--usr.sbin/ospf6d/rde.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c
index d9b4665f677..8d2d289e8ca 100644
--- a/usr.sbin/ospf6d/rde.c
+++ b/usr.sbin/ospf6d/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.39 2010/06/01 11:22:28 bluhm Exp $ */
+/* $OpenBSD: rde.c,v 1.40 2010/06/01 11:29:29 bluhm Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -1270,7 +1270,8 @@ prefix_tree_add(struct prefix_tree *tree, struct lsa_link *lsa)
cur_prefix = (char *)(lsa + 1);
for (i = 0; i < ntohl(lsa->numprefix); i++) {
- new = calloc(sizeof(*new), 1);
+ if ((new = calloc(1, sizeof(*new))) == NULL)
+ fatal("prefix_tree_add");
new->prefix = (struct lsa_prefix *)cur_prefix;
len = sizeof(*new->prefix)