From 7f7182b97c1a62bb6ba9ded47fa72f576864ae6c Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Fri, 19 Dec 2003 01:13:35 +0000 Subject: for(p = something; p != NULL; p = p->next) is not going to fly if there is a free(p) inside that for loop... --- usr.sbin/bgpd/rde.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 377d7500ed5..1fda1e3161e 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.4 2003/12/18 22:22:22 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.5 2003/12/19 01:13:34 henning Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -523,7 +523,7 @@ struct peer_table { void peer_init(struct bgpd_config *bgpconf, u_long hashsize) { - struct peer *p; + struct peer *p, *next; u_long hs, i; for (hs = 1; hs < hashsize; hs <<= 1) ; @@ -537,7 +537,8 @@ peer_init(struct bgpd_config *bgpconf, u_long hashsize) peertable.peer_hashmask = hs - 1; - for (p = bgpconf->peers; p != NULL; p = p->next) { + for (p = bgpconf->peers; p != NULL; p = next) { + next = p->next; p->conf.reconf_action = RECONF_NONE; peer_add(p->conf.id, &p->conf); free(p); -- cgit v1.2.3