summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-01-20 15:34:56 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-01-20 15:34:56 +0000
commit440f6b4f15c12e02859a2ddc215f39b7e7978012 (patch)
tree605cc14d8036a01e7305d625c2e9308050ab404b /usr.sbin/bgpd
parent54f34fd0f318cbd44a76e2b1a17f103fe61cf3a7 (diff)
No need to calloc() others if others_len is 0. The 0 malloc() does not hurt
(we do not access it) but does not help either. Finally it reduces head scratching when debugging the RIB. OK henning@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/rde_attr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c
index bd38ab4563c..25144695ab9 100644
--- a/usr.sbin/bgpd/rde_attr.c
+++ b/usr.sbin/bgpd/rde_attr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_attr.c,v 1.59 2006/01/20 15:14:40 claudio Exp $ */
+/* $OpenBSD: rde_attr.c,v 1.60 2006/01/20 15:34:55 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -178,9 +178,14 @@ attr_copy(struct rde_aspath *t, struct rde_aspath *s)
if (t->others != NULL)
attr_freeall(t);
+ t->others_len = s->others_len;
+ if (t->others_len == 0) {
+ t->others = NULL;
+ return;
+ }
+
if ((t->others = calloc(s->others_len, sizeof(struct attr *))) == 0)
fatal("attr_copy");
- t->others_len = s->others_len;
for (l = 0; l < t->others_len; l++) {
if (s->others[l] == NULL)