summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2006-05-25 01:41:13 +0000
committerchristos <christos@NetBSD.org>2006-05-25 01:41:13 +0000
commit6388d5cc988caf4d0a2099f959dfd55f07334329 (patch)
treefc3a9005fc134968ebdd2a5e8d7743e83a1e3be4
parent43c323928f64f0c66c62cc42a937d8050c5730ad (diff)
Coverity CID 1191, 1192: Don't check for NULL allocation, just to log it
and then die dereferencing. Return instead.
-rw-r--r--usr.sbin/mrouted/prune.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/mrouted/prune.c b/usr.sbin/mrouted/prune.c
index 558ed50cc64..c64e0c1cc8d 100644
--- a/usr.sbin/mrouted/prune.c
+++ b/usr.sbin/mrouted/prune.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prune.c,v 1.16 2006/05/12 01:27:27 mrg Exp $ */
+/* $NetBSD: prune.c,v 1.17 2006/05/25 01:41:13 christos Exp $ */
/*
* The mrouted program is covered by the license in the accompanying file
@@ -622,8 +622,10 @@ add_table_entry(u_int32_t origin, u_int32_t mcastgrp)
if (gt == NULL || gt->gt_mcastgrp != mcastgrp) {
gt = (struct gtable *)malloc(sizeof(struct gtable));
- if (gt == NULL)
+ if (gt == NULL) {
logit(LOG_ERR, 0, "ran out of memory");
+ return;
+ }
gt->gt_mcastgrp = mcastgrp;
gt->gt_timer = CACHE_LIFETIME(cache_lifetime);
@@ -1194,8 +1196,10 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen)
} else {
/* allocate space for the prune structure */
pt = (struct ptable *)(malloc(sizeof(struct ptable)));
- if (pt == NULL)
+ if (pt == NULL) {
logit(LOG_ERR, 0, "pt: ran out of memory");
+ return;
+ }
pt->pt_vifi = vifi;
pt->pt_router = src;